Fix a bad bug in the last submit

Also fix rescan to advance to the next record.