thread initialization bug fix