Fixing lock unlock before release.