Fixing some issues with email.rb logic