change locking for optimistic concurrency check