diff --git a/pystencils/boundaries/boundaryhandling.py b/pystencils/boundaries/boundaryhandling.py
index 4c3f8aec084746a71460f55e1f20c5b15b0cef0d..0a33fde2e2cee7a2f8f96d59d119f272b89d5b6e 100644
--- a/pystencils/boundaries/boundaryhandling.py
+++ b/pystencils/boundaries/boundaryhandling.py
@@ -99,7 +99,7 @@ class BoundaryHandling:
             gpu_version = gpu_version.boundary_object_to_index_list
             cpu_version = cpu_version.boundary_object_to_index_list
 
-            if isinstance(self.data_handling, ParallelDataHandling):
+            if ParallelDataHandling and isinstance(self.data_handling, ParallelDataHandling):
                 array_handler = PyCudaArrayHandler()
             else:
                 array_handler = self.data_handling.array_handler