fix bugs in parser