Fix race condition in #144
Merge remote-tracking branch 'origin/gh-144-fix-race'