Fix "pthread not linked" bug