fix query builder