Fix broken queries