fix hostname retrieval