MANTA-58 fix off-by-one in scanEnd, assert conditions