Prevent hostname from being empty.