fix serious bug in pthread_join