Fix some race conditions in the EndpointPolicyImpl