move towards using query_name caching as requested
actually implement query_name on demand
simple test for set_bdflag