more robust set_media_domains script