diff --git a/src/dynamic_graph/dynamic-graph-py.cc b/src/dynamic_graph/dynamic-graph-py.cc
index 5ab7b172bc60d953e22028c10855d41875e8c81a..f4762ba008f72b4ed3454ced56c9252064862b26 100644
--- a/src/dynamic_graph/dynamic-graph-py.cc
+++ b/src/dynamic_graph/dynamic-graph-py.cc
@@ -40,8 +40,10 @@ PyObject* plug(PyObject* /*self*/, PyObject* args) {
 
   pObjIn = PyCapsule_GetPointer(objIn, "dynamic_graph.Signal");
   SignalBase<int>* signalIn = (SignalBase<int>*)pObjIn;
+  if (signalIn == NULL) return NULL;
   pObjOut = PyCapsule_GetPointer(objOut, "dynamic_graph.Signal");
   SignalBase<int>* signalOut = (SignalBase<int>*)pObjOut;
+  if (signalOut == NULL) return NULL;
   std::ostringstream os;
 
   try {
diff --git a/unitTesting/CMakeLists.txt b/unitTesting/CMakeLists.txt
index 9b793685030aff9af7398830741a47d84f120036..a8a5190ce4b91866e56cdcc8749eba1cbd87d346 100644
--- a/unitTesting/CMakeLists.txt
+++ b/unitTesting/CMakeLists.txt
@@ -1,5 +1,3 @@
-# Test bindings
-ADD_PYTHON_UNIT_TEST("test-bindings" "unitTesting/test_bindings.py" src)
 
 # Test the interpreter
 SET(EXECUTABLE_NAME interpreter-test)
@@ -59,3 +57,6 @@ TARGET_LINK_LIBRARIES(${PYTHON_MODULE} ${PUBLIC_KEYWORD} ${LIBRARY_NAME} ${PYTHO
 
 ## Test it
 ADD_PYTHON_UNIT_TEST("test-custom-entity" "unitTesting/test_custom_entity.py" src unitTesting)
+
+# also test other bindings, using this custom entity
+ADD_PYTHON_UNIT_TEST("test-bindings" "unitTesting/test_bindings.py" src unitTesting)
diff --git a/unitTesting/test_bindings.py b/unitTesting/test_bindings.py
index ffb83c0348a34be952c875d24321e17b5e6b4acb..62c86ab0630c20c528625a643eae00748c73df6e 100644
--- a/unitTesting/test_bindings.py
+++ b/unitTesting/test_bindings.py
@@ -1,13 +1,24 @@
 import unittest
 
-import dynamic_graph
+import dynamic_graph as dg
+from custom_entity import CustomEntity
 
 
 class BindingsTests(unittest.TestCase):
     def test_bindings(self):
-        with self.assertRaises(Exception) as error:
-            dynamic_graph.error_out()
-            self.assertEqual(str(error), "something bad happend")
+        with self.assertRaises(Exception) as cm:
+            dg.error_out()
+        self.assertEqual(str(cm.exception), "something bad happened")
+
+    def test_type_check(self):
+        first = CustomEntity('first_entity')
+        second = CustomEntity('second_entity')
+        # Check that we can connect first.out to second.in
+        dg.plug(first.signal('out_double'), second.signal('in_double'))
+        # Check that we can't connect first.out to second
+        with self.assertRaises(ValueError) as cm:
+            dg.plug(first.signal('out_double'), second)
+        self.assertEqual(str(cm.exception), "PyCapsule_GetPointer called with incorrect name")
 
 
 if __name__ == '__main__':