Fix serious bug in how we set the endpoint.