Fixed bug in error reporting in the scanner