Gracefully deal with invalid hostnames