fixed some parsing bugs