Fixed a lock/unlock glitch