adjust algorithm for updating tenant in construct_url