Fix problem where hostname would end up with trailing . and be accepted as