Typo fix.
Drastically improved handling of thread stop event.