fix the bug in create thread