Added flag-setting code in restore command.