Revert previous change that allowed some operations to be performed without holding the lock, as it introduced a race condition in certain multithreaded scenarios.