Fixed bugs in parser