patch from domain_remap bugfixes