Improved errors returned from the scanner