improved send_query