diff --git a/python/dune/perftool/sumfact/basis.py b/python/dune/perftool/sumfact/basis.py
index c1ca1a842601a790bc10bcefda5ec8d0c44ce409..aa4b0ddec4ef9b96049adb8d2e93fb6adde8b1b5 100644
--- a/python/dune/perftool/sumfact/basis.py
+++ b/python/dune/perftool/sumfact/basis.py
@@ -148,7 +148,8 @@ def pymbolic_coefficient_gradient(element, restriction, index, coeff_func, visit
     # If this sum factorization kernel was not used in the dry run we
     # just return 0
     if vsf == 0:
-        return 0, None
+        visitor.indices = None
+        return 0
 
     from dune.perftool.sumfact.realization import realize_sum_factorization_kernel
     var, insn_dep = realize_sum_factorization_kernel(vsf)
@@ -189,7 +190,8 @@ def pymbolic_coefficient(element, restriction, index, coeff_func, visitor):
     # If this sum factorization kernel was not used in the dry run we
     # just return 0
     if vsf == 0:
-        return 0, None
+        visitor.indices = None
+        return 0
 
     # Add a sum factorization kernel that implements the evaluation of
     # the basis functions at quadrature points (stage 1)