improved error handling, implementing new email insert api