#175 fix to what looks like a very unlikely race condition