fix email sending twice and the success page