Some parsing fixes and tests.