Fixes to email parsing