diff --git a/libraries/export/htmlword.php b/libraries/export/htmlword.php
index 46485cf070..1153f6a1bd 100644
--- a/libraries/export/htmlword.php
+++ b/libraries/export/htmlword.php
@@ -310,7 +310,7 @@ if (isset($plugin_list)) {
}
$schema_insert .= '';
- } // end while
+ } // end foreach
$schema_insert .= '';
return $schema_insert;