Bug fixes to parser