fix a bug in th_join