Fixed some bugs on parsing