diff --git a/src/main.rs b/src/main.rs
index 45a552c60be3f22fc562cd6d0d8f3170955aa7bc..7223584d5009fde938b4c06833e4aa4361fd5d2c 100644
--- a/src/main.rs
+++ b/src/main.rs
@@ -167,6 +167,7 @@ fn main() {
             init::init_and_hook(init.hooks, &init.compression, &init.mode);
         }
         Commands::Commit(commit) => {
+            mount::umount_archive(true);
             if commit.revert {
                 if commit.revert == commit.update {
                     eprintln!("Error: You moust choose between --revert and --update option")
@@ -182,9 +183,11 @@ fn main() {
             list::borg_list(list.first, list.last, &list.archive);
         }
         Commands::PreCo => {
+            mount::umount_archive(true);
             checkout::prepare_checkout();
         }
         Commands::Checkout(co) => {
+            mount::umount_archive(true);
             checkout::checkout(&co.mode);
         }
         Commands::CreateHooks(ch) => {
@@ -197,10 +200,11 @@ fn main() {
             create_hooks::delete_hooks();
         }
         Commands::Mount(mount) => {
+            mount::umount_archive(true);
             mount::mount_archive(&mount.commit, &mount.path, mount.versions);
         }
         Commands::Umount => {
-            mount::umount_archive();
+            mount::umount_archive(false);
         }
     }
 }