fix variable, add new case for custom fields