Fixed the issue with TypeErrors causing it exepect in the threads