make get_domain more flexible