fix thread issue
format code
Merge pull request #12 from prt2121/master

Fix Thread Issue