Fixing a bug in locks: latestValue should have similar value with currentValue.