fix hostname function