Fixes for email handling and upgrade to VS2013