Fix Thread Issue

* Fix thread issue
* Format code