fixed thread destructor