Added check for form resubmission, preventing warning happening twice.