Fixed thread issue