Fixed the endpoint bug