Fix the -pthreads issues