fix hostname detection