Fixed race condition bug
Merge pull request #127 from b2coutts/master

Fixed race condition bug