Fixes #285
Merge pull request #286 from SpiderOak/issue-285-race-condition

Fixes #285