diff --git a/python/dune/perftool/compile.py b/python/dune/perftool/compile.py
index cd5344c0da55f68b88a3ea1809f800105160fbbc..c2acf843aa4a22723eda39369572a39e2c76e383 100644
--- a/python/dune/perftool/compile.py
+++ b/python/dune/perftool/compile.py
@@ -100,7 +100,7 @@ def read_ufl(uflfile):
         data.object_by_name[name] = namespace.get(name, None)
 
     formdatas = []
-    forms = data.forms
+    forms = list(data.forms)
     for index, form in enumerate(forms):
         formdatas.append(preprocess_form(form))
         forms[index] = formdatas[index].preprocessed_form
diff --git a/python/dune/perftool/pdelab/spaces.py b/python/dune/perftool/pdelab/spaces.py
index 068672bafbd2c5196d7b4bd01dfb62c2d1e789fc..e69583ce3a6671195b63a8336f14412f4895ab03 100644
--- a/python/dune/perftool/pdelab/spaces.py
+++ b/python/dune/perftool/pdelab/spaces.py
@@ -6,7 +6,6 @@ from dune.perftool.generation import (class_member,
                                       generator_factory,
                                       include_file,
                                       preamble,
-                                      backend,
                                       )
 from dune.perftool.pdelab.restriction import restricted_name
 from dune.perftool.ufl.modified_terminals import Restriction
@@ -20,19 +19,8 @@ from functools import partial
 import numpy
 
 
-@preamble
-def define_lfs_bound(lfs, bound):
-    return 'auto {} = {}.size();'.format(bound, lfs)
-
-
 def name_lfs_bound(lfs):
-    # LFS might either be given by an UFL element or by a string describing its name
-    from ufl import FiniteElementBase
-    if isinstance(lfs, FiniteElementBase):
-        return name_lfs_bound(name_lfs(lfs))
-
     bound = '{}_size'.format(lfs)
-    define_lfs_bound(lfs, bound)
     return bound
 
 
@@ -78,7 +66,9 @@ def available_gfs_names(element, restriction, name=None):
 @preamble
 def define_lfs(name, father, child):
     using_indices()
-    return "auto {} = child({}, _{});".format(name, father, child)
+    bound = name_lfs_bound(name)
+    return ["auto {} = child({}, _{});".format(name, father, child),
+            "auto {} = {}.size();".format(bound, name)]
 
 
 @class_member(classtag="operator")