fix the thread confusion bug