change gethostname to detect_hostname