Solve query builder bug