fixed several parsing bugs.