UBI: fix bug in image sequence number handling