fix a few parsing bugs