Fixed error in hostname detection