Fix email parsing bugs