query parser fixes. Fixes #1