diff --git a/templates/CRM/Form/body.tpl b/templates/CRM/Form/body.tpl
index 4f8e4667..6a1c7f40 100644
--- a/templates/CRM/Form/body.tpl
+++ b/templates/CRM/Form/body.tpl
@@ -15,7 +15,7 @@
{$form.hidden}
{/if}
-{if ($snippet !== 'json') and !$suppressForm and count($form.errors) gt 0}
+{if ($snippet !== 'json') and !$suppressForm and count((array)$form.errors) gt 0}
{ts}Please correct the following errors in the form fields below:{/ts}