iron out some bugs in parser