fix query builder issues