correcting query