Fix segmentation fault

Fix a seg fault when tried to init a new thread