diff --git a/Civi/DataProcessor/DataFlow/SqlDataFlow.php b/Civi/DataProcessor/DataFlow/SqlDataFlow.php
index bbd2c2fd259089921daaa59bfd8a788828e201b6..15e7d8ba4509d55eb4a70ac58b2a46c52e721059 100644
--- a/Civi/DataProcessor/DataFlow/SqlDataFlow.php
+++ b/Civi/DataProcessor/DataFlow/SqlDataFlow.php
@@ -132,6 +132,8 @@ abstract class SqlDataFlow extends AbstractDataFlow {
 
     $countSql = "";
     $sql = "";
+    $this->sqlCountStatements = [];
+    $this->sqlStatements = [];
 
     try {
       $selectAndFrom = $this->getSelectQueryStatement();
diff --git a/Civi/DataProcessor/FieldOutputHandler/AbstractSimpleFieldOutputHandler.php b/Civi/DataProcessor/FieldOutputHandler/AbstractSimpleFieldOutputHandler.php
index 0f1db28720057688f51462e493894bb87cf933cc..e9a84e2627f9959abbf9004a6c9adc1dfedc964a 100644
--- a/Civi/DataProcessor/FieldOutputHandler/AbstractSimpleFieldOutputHandler.php
+++ b/Civi/DataProcessor/FieldOutputHandler/AbstractSimpleFieldOutputHandler.php
@@ -85,12 +85,13 @@ class AbstractSimpleFieldOutputHandler extends AbstractFieldOutputHandler {
    * @return \Civi\DataProcessor\FieldOutputHandler\FieldOutput
    */
   public function formatField($rawRecord, $formattedRecord) {
+    $rawValue = $rawRecord[$this->inputFieldSpec->alias] ?? '';
     $formattedValue = $rawRecord[$this->inputFieldSpec->alias] ?? '';
     if (strpos($formattedValue, \CRM_Core_DAO::VALUE_SEPARATOR) !== false) {
       $formattedValue = explode(\CRM_Core_DAO::VALUE_SEPARATOR, trim($formattedValue,\CRM_Core_DAO::VALUE_SEPARATOR));
       $formattedValue = implode(",", $formattedValue);
     }
-    $output = new FieldOutput($rawRecord[$this->inputFieldSpec->alias]);
+    $output = new FieldOutput($rawValue);
     $output->formattedValue = $formattedValue;
     return $output;
   }