for cleaning up attachments, changed hook to check only on every form submission
changed hook for cleaning up attachments