fix the query