Fix race condition
Merge pull request #7 from ahcorde/master

Fix race condition