query_num fix