fix query parsing bug