diff --git a/include/class.forms.php b/include/class.forms.php
index 2e00f7391dfcb0b3c22e1100a2aca25ac6048246..5022a8ce2808fa88c56f52205b66ad5186f08c2b 100644
--- a/include/class.forms.php
+++ b/include/class.forms.php
@@ -4604,7 +4604,9 @@ class FreeTextWidget extends Widget {
         if (($attachments = $this->field->getAttachments()) && count($attachments)) { ?>
             <section class="freetext-files">
             <div class="title"><?php echo __('Related Resources'); ?></div>
-            <?php foreach ($attachments->all() as $attach) { ?>
+            <?php foreach ($attachments->all() as $attach) {
+                $filename = $attach->getFilename();
+                ?>
                 <div class="file">
                 <a href="<?php echo $attach->file->getDownloadUrl(); ?>"
                     target="_blank" download="<?php echo $filename; ?>"
diff --git a/setup/test/tests/stubs.php b/setup/test/tests/stubs.php
index 4cb35183c3ea3593ff0efc0b20babd1ad7f5e244..4c96e7104ddef6b216762a3db4b95025095082f8 100644
--- a/setup/test/tests/stubs.php
+++ b/setup/test/tests/stubs.php
@@ -229,6 +229,7 @@ class Mail_mime {
 
 class mPDF {
     function Output() {}
+    function SetAutoFont() {}
 }
 
 class HashPassword {