Fix up mail code