Make sure we always normalize hostnames with underscores in them.

Underscores are not valid in hostnames, so we need to translate them to a valid character.