Fix error when getting hostname