Fixing bug with emails not being sent.