corrected query