improve hostname escaping