fixed logic to determine if form has already been submitted