Fixed the pthread problem