Fix off-by-one in sort scan.