fixing quary