Fixing several bugs in the parser