add a couple of safety checks in populate_default_dns
so we do not end up with a badly formed xml file and other bad things