HOST and PORT KeyError fix