fixed a bug in the parser and some tests