Fixing race conditions in event stores