Statement parser fixes and tests