Fixed the thread abort bug