diff --git a/include/class.dynamic_forms.php b/include/class.dynamic_forms.php
index 406495e08d60e99ad08589b8c82a85773773d46b..39e73162b9c675f154a554ca3f11abb9bc7dd9e2 100644
--- a/include/class.dynamic_forms.php
+++ b/include/class.dynamic_forms.php
@@ -906,14 +906,26 @@ class DynamicFormField extends VerySimpleModel {
     }
 
     function delete() {
-        // Don't really delete form fields as that will screw up the data
+        // Don't really delete form fields with data as that will screw up the data
         // model. Instead, just drop the association with the form which
         // will give the appearance of deletion. Not deleting means that
         // the field will continue to exist on form entries it may already
         // have answers on, but since it isn't associated with the form, it
         // won't be available for new form submittals.
         $this->set('form_id', 0);
-        $this->save();
+
+        $impl = $this->getImpl();
+
+        // Trigger db_clean so the field can do house cleaning
+        $impl->db_cleanup(true);
+
+        // Short-circuit deletion if the field has data.
+        if ($impl->hasData())
+            return $this->save();
+
+        // Delete the field for realz
+        parent::delete();
+
     }
 
     function save($refetch=false) {
diff --git a/include/class.forms.php b/include/class.forms.php
index c1624b517df9acab2c9980396b9608c33d8b05cb..5112c0aefdab633050c213443161cc9a55148739 100644
--- a/include/class.forms.php
+++ b/include/class.forms.php
@@ -604,7 +604,7 @@ class FormField {
      * cleaned as well. This hook allows fields to participate when the data
      * for a field is cleaned up.
      */
-    function db_cleanup() {
+    function db_cleanup($field=false) {
     }
 
     /**
@@ -2406,7 +2406,7 @@ class FileUploadField extends FormField {
         return implode(', ', $files);
     }
 
-    function db_cleanup() {
+    function db_cleanup($field=false) {
         // Delete associated attachments from the database, if any
         $this->getFiles();
         if (isset($this->attachments)) {
@@ -3221,9 +3221,9 @@ class FreeTextField extends FormField {
         return $config;
     }
 
-    function db_cleanup() {
+    function db_cleanup($field=false) {
 
-        if ($this->getFiles())
+        if ($field && $this->getFiles())
             $this->getAttachments()->deleteAll();
     }
 
@@ -3271,7 +3271,7 @@ class FreeTextWidget extends Widget {
                 <a href="<?php echo $attach->file->getDownloadUrl(); ?>"
                     target="_blank" class="no-pjax">
                     <i class="icon-file"></i>
-                    <?php echo Format::htmlchars($attach->getFileName()); ?>
+                    <?php echo Format::htmlchars($attach->getFilename()); ?>
                 </a>
                 </div>
             <?php } ?>