Improve/fix error report in ScanRecord.

Thanks to Harry B (harikb)