fix query_wrapper