diff --git a/src/jamidht/jamiaccount.cpp b/src/jamidht/jamiaccount.cpp
index eb57130db4a4e848d4e7b4795e3b5d81eb5de389..e88b560060396dd2f6df298897b7f90c05cc8830 100644
--- a/src/jamidht/jamiaccount.cpp
+++ b/src/jamidht/jamiaccount.cpp
@@ -699,7 +699,8 @@ void JamiAccount::serialize(YAML::Emitter &out) const
     out << YAML::Key << DRing::Account::ConfProperties::ARCHIVE_PATH << YAML::Value << archivePath_;
     out << YAML::Key << DRing::Account::ConfProperties::ARCHIVE_HAS_PASSWORD << YAML::Value << archiveHasPassword_;
     out << YAML::Key << Conf::RING_ACCOUNT_RECEIPT << YAML::Value << receipt_;
-    out << YAML::Key << Conf::RING_ACCOUNT_RECEIPT_SIG << YAML::Value << YAML::Binary(receiptSignature_.data(), receiptSignature_.size());
+    if (receiptSignature_.size() > 0)
+        out << YAML::Key << Conf::RING_ACCOUNT_RECEIPT_SIG << YAML::Value << YAML::Binary(receiptSignature_.data(), receiptSignature_.size());
     out << YAML::Key << DRing::Account::ConfProperties::RING_DEVICE_NAME << YAML::Value << ringDeviceName_;
     out << YAML::Key << DRing::Account::ConfProperties::MANAGER_URI << YAML::Value << managerUri_;
     out << YAML::Key << DRing::Account::ConfProperties::MANAGER_USERNAME << YAML::Value << managerUsername_;
diff --git a/src/jamidht/server_account_manager.cpp b/src/jamidht/server_account_manager.cpp
index 18bc6e773dd24910ecdbfcb8a9c60088f692312a..fecb5fd1babc05f28c9ae614cb66246fd638c5f6 100644
--- a/src/jamidht/server_account_manager.cpp
+++ b/src/jamidht/server_account_manager.cpp
@@ -103,7 +103,10 @@ ServerAccountManager::initAuthentication(
         JAMI_ERR("[Auth] Got server response: %d", (int)state);
         if (state != Request::State::DONE)
             return;
-        if (response.status_code >= 400 && response.status_code < 500)
+        if (response.status_code == 0) {
+            ctx->onFailure(AuthError::SERVER_ERROR, "Invalid server provided");
+            return;
+        } else if (response.status_code >= 400 && response.status_code < 500)
             ctx->onFailure(AuthError::INVALID_ARGUMENTS, "");
         else if (response.status_code < 200 || response.status_code > 299)
             ctx->onFailure(AuthError::INVALID_ARGUMENTS, "");