diff --git a/bob/io/base/hdf5.cpp b/bob/io/base/hdf5.cpp
index b68dce773a30aa2ded8c4cccd28460c0886807b0..3144461eadb75e1b7f96c376526a0cc75787c141 100644
--- a/bob/io/base/hdf5.cpp
+++ b/bob/io/base/hdf5.cpp
@@ -121,11 +121,12 @@ static int PyBobIoHDF5File_Init(PyBobIoHDF5FileObject* self,
   auto k_ = make_safe(k);
   if (
     (kwds && PyDict_Contains(kwds, k)) ||
-    (args && PyBobIoHDF5File_Check(PyTuple_GetItem(args, 0)))
+    (args && PyBobIoHDF5File_Check(PyTuple_GET_ITEM(args, 0)))
   ){
     PyBobIoHDF5FileObject* other;
     if (!PyArg_ParseTupleAndKeywords(args, kwds, "O&", kwlist2, &PyBobIoHDF5File_Converter, &other))
       return -1;
+    auto other_ = make_safe(other);
     self->f = other->f;
     return 0;
   }