Fix bugs in email and ticket