Fixed pthread initialization bug