diff --git a/src/dht_proxy_server.cpp b/src/dht_proxy_server.cpp
index 586a8b775cccfe169b21aab15d8867a164b2f89d..6aef30ac4d8674c5ee1bd078c82e615955b10aa8 100644
--- a/src/dht_proxy_server.cpp
+++ b/src/dht_proxy_server.cpp
@@ -322,7 +322,7 @@ DhtProxyServer::putEncrypted(const std::shared_ptr<restbed::Session>& session) c
                     std::string strJson(buf.begin(), buf.end());
                     bool parsingSuccessful = reader.parse(strJson.c_str(), root);
                     InfoHash to(root["to"].asString());
-                    if (parsingSuccessful && toInfoHash) {
+                    if (parsingSuccessful && to) {
                         auto value = std::make_shared<Value>(root);
                         Json::FastWriter writer;
                         dht_->putEncrypted(key, to, value);