modified the some functions for using use_query in the test