Thread exeption fix