diff --git a/src/connectionmanager.cpp b/src/connectionmanager.cpp
index dafd33885c2a7111daa181021cbff6651295ed9f..2b6e54452f44b317247d3f7336eb84205b0300fc 100644
--- a/src/connectionmanager.cpp
+++ b/src/connectionmanager.cpp
@@ -1345,9 +1345,9 @@ ConnectionManager::Impl::loadTreatedMessages()
 {
     std::lock_guard<std::mutex> lock(messageMutex_);
     auto path = config_->cachePath / "treatedMessages";
-    treatedMessages_ = loadIdList<std::string>(path);
+    treatedMessages_ = loadIdList<std::string>(path.string());
     if (treatedMessages_.empty()) {
-        auto messages = loadIdList(path);
+        auto messages = loadIdList(path.string());
         for (const auto& m : messages)
             treatedMessages_.emplace(to_hex_string(m));
     }
diff --git a/src/fileutils.cpp b/src/fileutils.cpp
index d4decab84ce73a9ee1fce086c9e1674248bd2ab0..95199e3e838b02a0e32a14f6b80f664732543764 100644
--- a/src/fileutils.cpp
+++ b/src/fileutils.cpp
@@ -319,15 +319,15 @@ int
 remove(const std::filesystem::path& path, bool erase)
 {
     if (erase and isFile(path, false) and !hasHardLink(path))
-        eraseFile(path, true);
+        eraseFile(path.string(), true);
 
 #ifdef _WIN32
     // use Win32 api since std::remove will not unlink directory in use
     if (isDirectory(path))
-        return !RemoveDirectory(dhtnet::to_wstring(path).c_str());
+        return !RemoveDirectory(dhtnet::to_wstring(path.string()).c_str());
 #endif
 
-    return std::remove(path.c_str());
+    return std::remove(path.string().c_str());
 }
 
 int
@@ -350,7 +350,7 @@ void
 openStream(std::ifstream& file, const std::filesystem::path& path, std::ios_base::openmode mode)
 {
 #ifdef _WIN32
-    file.open(dhtnet::to_wstring(path), mode);
+    file.open(dhtnet::to_wstring(path.string()), mode);
 #else
     file.open(path, mode);
 #endif
@@ -360,7 +360,7 @@ void
 openStream(std::ofstream& file, const std::filesystem::path& path, std::ios_base::openmode mode)
 {
 #ifdef _WIN32
-    file.open(dhtnet::to_wstring(path), mode);
+    file.open(dhtnet::to_wstring(path.string()), mode);
 #else
     file.open(path, mode);
 #endif
@@ -370,7 +370,7 @@ std::ifstream
 ifstream(const std::filesystem::path& path, std::ios_base::openmode mode)
 {
 #ifdef _WIN32
-    return std::ifstream(dhtnet::to_wstring(path), mode);
+    return std::ifstream(dhtnet::to_wstring(path.string()), mode);
 #else
     return std::ifstream(path, mode);
 #endif
@@ -380,7 +380,7 @@ std::ofstream
 ofstream(const std::filesystem::path& path, std::ios_base::openmode mode)
 {
 #ifdef _WIN32
-    return std::ofstream(dhtnet::to_wstring(path), mode);
+    return std::ofstream(dhtnet::to_wstring(path.string()), mode);
 #else
     return std::ofstream(path, mode);
 #endif
@@ -390,7 +390,7 @@ int
 accessFile(const std::filesystem::path& file, int mode)
 {
 #ifdef _WIN32
-    return _waccess(dhtnet::to_wstring(file).c_str(), mode);
+    return _waccess(dhtnet::to_wstring(file.string()).c_str(), mode);
 #else
     return access(file.c_str(), mode);
 #endif
diff --git a/src/security/certstore.cpp b/src/security/certstore.cpp
index ee5b9d65daec0be5f5a0b9f9b26d7482f69c5585..e58b288d16ab4b0df901d10c54aa8c3fed1f39b6 100644
--- a/src/security/certstore.cpp
+++ b/src/security/certstore.cpp
@@ -279,7 +279,7 @@ CertificateStore::pinCertificatePath(const std::string& path,
                                      std::function<void(const std::vector<std::string>&)> cb)
 {
     dht::ThreadPool::computation().run([&, path, cb]() {
-        auto certs = readCertificates(path, crlPath_);
+        auto certs = readCertificates(path, crlPath_.string());
         std::vector<std::string> ids;
         std::vector<std::weak_ptr<crypto::Certificate>> scerts;
         ids.reserve(certs.size());