fix for multiple lock/unlock operations in 'lock' command (found by framer99)