diff --git a/ckanext/odsh/templates/snippets/custom_form_fields.html b/ckanext/odsh/templates/snippets/custom_form_fields.html
index e9983eca4ab4d7b838d5ba754ba9b8ebe73da681..0909644fe6e7e1f54b585cf0563fc4f788ceef69 100644
--- a/ckanext/odsh/templates/snippets/custom_form_fields.html
+++ b/ckanext/odsh/templates/snippets/custom_form_fields.html
@@ -27,7 +27,7 @@ Example:
   {% endfor %}
 
   {# Add a max of 3 empty columns #}
-  {% set total_extras = data.extras|count %}
+  {% set total_extras = extras|count %}
   {% if total_extras <= (custom_extras|count) %}{% set total_extras = (custom_extras|count) %}{% endif %}
   {% set empty_extras = (limit or 3) - total_extras %}
   {% if empty_extras <= 0 %}{% set empty_extras = 1 %}{% endif %}