fixed a problem with clean up of join thread