thread terminate correction