fix thread manage