diff --git a/python/dune/perftool/sumfact/sumfact.py b/python/dune/perftool/sumfact/sumfact.py
index 86731a144110321f4c98c82b1328691a90e5ad03..d363fc0c3f574b79d2724c04e5b97613267ca7a1 100644
--- a/python/dune/perftool/sumfact/sumfact.py
+++ b/python/dune/perftool/sumfact/sumfact.py
@@ -247,7 +247,8 @@ def generate_accumulation_instruction(visitor, accterm, measure, subdomain_id):
         if get_option('fastdg'):
             ft = get_global_context_value("form_type")
             if ft=='residual':
-                globalarg(accum, dtype=np.float64, shape=(ansatz_lfs.index,), managed=False)
+                size = basis_functions_per_direction() ** world_dimension()
+                globalarg(accum, dtype=np.float64, shape=(size,), managed=False)
                 assignee = prim.Subscript(prim.Variable(accum), (test_lfs.index,))
                 expression = prim.Sum((assignee,result))
                 instruction(assignee=assignee,
@@ -259,7 +260,8 @@ def generate_accumulation_instruction(visitor, accterm, measure, subdomain_id):
             else:
                 assert ft=='jacobian'
                 # palpo TODO: think about it
-                globalarg(accum, dtype=np.float64, shape=(ansatz_lfs.index, test_lfs.index), managed=False)
+                size = basis_functions_per_direction() ** world_dimension()
+                globalarg(accum, dtype=np.float64, shape=(size, size), managed=False)
                 assignee = prim.Subscript(prim.Variable(accum), (ansatz_lfs.index, test_lfs.index))
                 expression = prim.Sum((assignee,result))
                 instruction(assignee=assignee,