fixing queries