fixed lots of bugs with parsing