diff --git a/configure.ac b/configure.ac
index 8fbc2827629836f500fb9ed7a5ee1cc56a5b8daa..74b86bb0b349ff4411ec58d1157c4c553663a1fd 100644
--- a/configure.ac
+++ b/configure.ac
@@ -430,7 +430,7 @@ AC_ARG_WITH([restcpp],
     AS_HELP_STRING([--with-restcpp], [enable rest support with C++]))
 AC_ARG_ENABLE([restbed_old_api], AS_HELP_STRING([--enable-restbed-old-api], [Use the old restbed API]))
 AS_IF([test "x$enable_restbed_old_api" = "xyes"], [
-  AC_DEFINE([RESTBED_OLD_API], [], [Defined if you use the old restbed API])
+  AC_DEFINE([RESTBED_OLD_API], [1], [Defined if you use the old restbed API])
 ])
 
 AS_IF([test "x$enable_ringns" != "xno" || test "x$with_restcpp" = "xyes"], [
diff --git a/src/ringdht/namedirectory.cpp b/src/ringdht/namedirectory.cpp
index ed918ba1f2504a729b231ed0b3157c4603fec7f6..2c4d5a777656be84c0ae24550ab74a5214fdb65d 100644
--- a/src/ringdht/namedirectory.cpp
+++ b/src/ringdht/namedirectory.cpp
@@ -21,6 +21,7 @@
 #include "string_utils.h"
 #include "thread_pool.h"
 #include "fileutils.h"
+#include "config.h"
 
 #include <msgpack.hpp>
 #include <json/json.h>
@@ -93,10 +94,11 @@ NameDirectory& NameDirectory::instance(const std::string& server)
 size_t getContentLength(restbed::Response& reply)
 {
     size_t length = 0;
-#ifndef RESTBED_OLD_API
-    length =
-#endif
+#ifdef RESTBED_OLD_API
     reply.get_header("Content-Length", length);
+#else
+    length = reply.get_header("Content-Length", 0);
+#endif
     return length;
 }