fixed custom fields and email sending