diff --git a/bob/learn/activation/activation.cpp b/bob/learn/activation/activation.cpp
index 2591e12999401b59507f0f46ce5204ea5f27bd1a..65bef2835e68f43ee07cbae6020e5a1a47965382 100644
--- a/bob/learn/activation/activation.cpp
+++ b/bob/learn/activation/activation.cpp
@@ -8,10 +8,11 @@
  */
 
 #define BOB_LEARN_ACTIVATION_MODULE
-#include <bob.learn.activation/api.h>
-#include <bob.io.base/api.h>
 #include <bob.blitz/cppapi.h>
 #include <bob.blitz/cleanup.h>
+#include <bob.extension/defines.h>
+#include <bob.learn.activation/api.h>
+#include <bob.io.base/api.h>
 #include <bob.learn.activation/Activation.h>
 #include <boost/bind.hpp>
 #include <boost/function.hpp>
@@ -63,7 +64,7 @@ PyObject* PyBobLearnActivation_NewFromActivation
 
   retval->cxx = a;
 
-  return reinterpret_cast<PyObject*>(retval);
+  return Py_BuildValue("N", retval);
 
 }
 
@@ -174,12 +175,11 @@ static PyObject* PyBobLearnActivation_call1(PyBobLearnActivationObject* self,
       return 0;
     }
 
-    Py_INCREF(res);
-    return PyBlitzArray_NUMPY_WRAP(res);
+    return PyBlitzArray_NUMPY_WRAP(Py_BuildValue("O", res));
 
   }
 
-  else if (PyNumber_Check(z)) {
+  else if (PyBob_NumberCheck(z)) {
 
     PyObject* z_float = PyNumber_Float(z);
     auto z_float_ = make_safe(z_float);
@@ -251,8 +251,7 @@ static PyObject* PyBobLearnActivation_call2(PyBobLearnActivationObject* self,
     return 0;
   }
 
-  Py_INCREF(res);
-  return PyBlitzArray_NUMPY_WRAP(reinterpret_cast<PyObject*>(res));
+  return PyBlitzArray_NUMPY_WRAP(Py_BuildValue("O", res));
 
 }
 
diff --git a/requirements.txt b/requirements.txt
index 6d514b193654ed2d2c35ac6cdda95e945ba869be..ac803d0bd1654b7b7290c37dde51db890600eece 100644
--- a/requirements.txt
+++ b/requirements.txt
@@ -1,5 +1,5 @@
 setuptools
-bob.extension
+bob.extension>2.0.4
 bob.blitz
 bob.core
 bob.io.base