fixed some bugs in parser