diff --git a/src/jamidht/jamiaccount.cpp b/src/jamidht/jamiaccount.cpp
index 36793772e36a98d85d804062d24121d4fdf605b9..a7e53ca6575efa71e8c1b75726adaa95fa097091 100644
--- a/src/jamidht/jamiaccount.cpp
+++ b/src/jamidht/jamiaccount.cpp
@@ -2546,6 +2546,7 @@ JamiAccount::doUnregister(std::function<void(bool)> released_cb)
 
     // Stop all current p2p connections if account is disabled
     // Else, we let the system managing if the co is down or not
+    // NOTE: this is used for changing account's config.
     if (not isEnabled())
         shutdownConnections();
 
diff --git a/src/manager.cpp b/src/manager.cpp
index d7a7ec6abef66fbd12c62d99ad652422f70fd9d2..db87e72edec50167d543e0a1fd37933ba1f4b8c7 100644
--- a/src/manager.cpp
+++ b/src/manager.cpp
@@ -997,8 +997,13 @@ void
 Manager::unregisterAccounts()
 {
     for (const auto& account : getAllAccounts()) {
-        if (account->isEnabled())
+        if (account->isEnabled()) {
+            if (auto acc = std::dynamic_pointer_cast<JamiAccount>(account)) {
+                // Note: shutdown the connections as doUnregister will not do it (because the account is enabled)
+                acc->shutdownConnections();
+            }
             account->doUnregister();
+        }
     }
 }