Fixed detection of hostname