Bug fixes for parser