added missing locking and unlocking command flag