Coerce hostnames to strings when sorting, as they may be nil.