Thread clean-up fix