Fix email bugs