fixed bug when endpoint stop() was called twice