fix broken query