prevent race condition (fixes #134)
Merge pull request #135 from callumlocke/master

Prevent race condition (fixes #134)