fix the broken query