diff --git a/pysegcnn/core/utils.py b/pysegcnn/core/utils.py
index 5556b629693fd870c0a25a57eaa8a9d1127e4158..d0c39d6f8f895323578804d65e90a4d64f133325 100644
--- a/pysegcnn/core/utils.py
+++ b/pysegcnn/core/utils.py
@@ -2217,8 +2217,8 @@ def array_replace(array, lookup):
 
     """
     # create an index array to replace the values in the lookup table
-    indices = np.arange(lookup[:, 0].max() + 1)
-    indices[lookup[:, 0]] = lookup[:, 1]
+    indices = np.arange(np.int(lookup[:, 0].max()) + 1).astype(object)
+    indices[lookup[:, 0].astype(np.int)] = lookup[:, 1]
 
     # the array with the replaced values
     return indices[array]