Fixed a bug that was sending two emails.