Fixing the lock acquiring problem