Backport fix in form validation