Fixed error where destructor for ThreadState didn't clear before deleting.