fix thread issue
format code