Fixed various bugs in the parser.