fixing bugs in parser