optimized locking