Fix bug related to db conflict

 - fix a bug where deleting the token would prevent settingthe email address
   when a db conflict occurs
 - part of the fix for emails