fix pending threads