fixed thread joining on termination