Fixes #336 and broken email sending.