fix threading bug
Merge pull request #23 from TETRA2000/master

fix threading bug