diff --git a/datahandling/serial_datahandling.py b/datahandling/serial_datahandling.py
index c53bf26ef44009ecc547675c2fc29c218b09f4f1..d803d13cbff8aa8a4235d0fe3a4b6a7cc641fd57 100644
--- a/datahandling/serial_datahandling.py
+++ b/datahandling/serial_datahandling.py
@@ -318,7 +318,7 @@ class SerialDataHandling(DataHandling):
             for name in data_names:
                 field = self._get_field_with_given_number_of_ghost_layers(name, ghost_layers)
                 if self.dim == 2:
-                    cell_data[name] = field[:, :, np.newaxis]
+                    field = field[:, :, np.newaxis]
                 if len(field.shape) == 3:
                     cell_data[name] = np.ascontiguousarray(field)
                 elif len(field.shape) == 4:
@@ -344,7 +344,7 @@ class SerialDataHandling(DataHandling):
             field = self._get_field_with_given_number_of_ghost_layers(data_name, ghost_layers)
             if self.dim == 2:
                 field = field[:, :, np.newaxis]
-            cell_data = {name: np.ascontiguousarray(np.bitwise_and(field, mask) > 0, dtype=np.uint8)
+            cell_data = {name: np.ascontiguousarray(np.bitwise_and(field, field.dtype.type(mask)) > 0, dtype=np.uint8)
                          for mask, name in masks_to_name.items()}
             image_to_vtk(full_file_name, cell_data=cell_data)
 
diff --git a/transformations/transformations.py b/transformations/transformations.py
index b26e019702cdc3ab2de19724ca7e54538a773fa3..bc7a4a742934bd5aeaa2144c428efce0d146d98a 100644
--- a/transformations/transformations.py
+++ b/transformations/transformations.py
@@ -1,7 +1,5 @@
 from collections import defaultdict, OrderedDict
-from operator import attrgetter
 from copy import deepcopy
-import functools
 
 import sympy as sp
 from sympy.logic.boolalg import Boolean