fix bug where it always sent email