threadNum bug fix