Optimistic locks fixes