Fix crash in pthread_create