- bug: THREAD_END must reset state to 0