Correct sort order for scans