query class corrected