diff --git a/pysegcnn/core/utils.py b/pysegcnn/core/utils.py
index d48c6d6d93e2f2095f95f6fe504ab682e341bbaf..570aeef129f12f37e55d40f15655879fea8362d1 100644
--- a/pysegcnn/core/utils.py
+++ b/pysegcnn/core/utils.py
@@ -2219,11 +2219,11 @@ def array_replace(array, lookup):
 
     """
     # create an index array to replace the values in the lookup table
-    indices = np.arange(np.int(lookup[:, 0].max()) + 1).astype(object)
+    indices = np.arange(np.int(lookup[:, 0].max()) + 1)
     indices[lookup[:, 0].astype(np.int)] = lookup[:, 1]
 
     # the array with the replaced values
-    return indices[array]
+    return indices[array].astype(array.dtype)
 
 
 def dec2bin(number, nbits=8):