Fix email template bugs not applying template