diff --git a/Civi/DataProcessor/FieldOutputHandler/RelationshipsFieldOutputHandler.php b/Civi/DataProcessor/FieldOutputHandler/RelationshipsFieldOutputHandler.php
index cde93ee9aec0ff21a358024570467bda73e9aac1..5c42cfaee76eaabfca8f65b0d8895a8aa299a486 100644
--- a/Civi/DataProcessor/FieldOutputHandler/RelationshipsFieldOutputHandler.php
+++ b/Civi/DataProcessor/FieldOutputHandler/RelationshipsFieldOutputHandler.php
@@ -257,7 +257,7 @@ class RelationshipsFieldOutputHandler extends AbstractFieldOutputHandler {
     $form->add('hidden', 'sorted_relationship_types', null, ['id' => 'sorted_relationship_types']);
     // Backwords compatibilty
     $form->assign('useSortIcon', false);
-    if (version_compare(CRM_Utils_System::version(), '5.15', '<')) {
+    if (version_compare(\CRM_Utils_System::version(), '5.15', '<')) {
       $form->assign('useSortIcon', true);
     }
 
diff --git a/templates/CRM/Dataprocessor/Form/DataProcessor.tpl b/templates/CRM/Dataprocessor/Form/DataProcessor.tpl
index 0ba8a6d0e74147a99f2b4f95b2a9f5bb30c345e5..1f7ed5e1412c2a72f1a7b897b8e93b34897d47bf 100644
--- a/templates/CRM/Dataprocessor/Form/DataProcessor.tpl
+++ b/templates/CRM/Dataprocessor/Form/DataProcessor.tpl
@@ -46,7 +46,7 @@
     <div class="content">{$form.is_active.html}</div>
     <div class="clear"></div>
   </div>
-  {if $data_processor_id}
+  {if $data_processor_id && $sortFields && count($sortFields)}
   <div class="crm-section">
     <div class="label">{ts}Default Sort{/ts}</div>
     <div class="content">