Removing some old code from EmailController and fixing the connection loss crash