fix thread issue