modify the query method