fix email bugs