Remove unnecessary lock/unlock calls when stack values