When "missing_fields_redirect" is set to "{= param.failure =}" (a hidden field in the web form, containing the submission-failed URL), TFMail.pl would redirect to "/cgi-bin/{= param.failure =}" instead of the actual URL, while the normal redirect function would work. Adding the line with "process_template" from the "return_html" sub to the "missing_html" sub fixed the issue.