fix some parsing bugs