Some parser fixes, and tests added