[fix] Stricter query checking