diff --git a/src/MatrixClient.cpp b/src/MatrixClient.cpp
index 2ceb53a8ed53e74cf1ab180e9aef34ac7651bf8f..ea3799b6c17e3a67f0cdcd518cc4a418625e1e06 100644
--- a/src/MatrixClient.cpp
+++ b/src/MatrixClient.cpp
@@ -28,22 +28,20 @@ Q_DECLARE_METATYPE(std::vector<std::string>)
 Q_DECLARE_METATYPE(std::vector<QString>)
 Q_DECLARE_METATYPE(std::set<QString>)
 
-namespace {
-auto client_ = std::make_shared<mtx::http::Client>();
-}
 
 namespace http {
 
 mtx::http::Client *
 client()
 {
+    static auto client_ = std::make_shared<mtx::http::Client>();
     return client_.get();
 }
 
 bool
 is_logged_in()
 {
-    return !client_->access_token().empty();
+    return !client()->access_token().empty();
 }
 
 void