fix a bug in the lexer which was reseting errormsg after parsing the input