fix email logging