fix logic error in Endpoint