corrected the query controller