A stab at #677 - it seems to act as expected 

- but as I can't produce a race condition ad-hoc, I can't guarantee it works