add nil check for endpoint_uri