Fix when secure option is enabled

Event was called twice causing a problem with gmail server