fix bug where invalid email address is not handled