diff --git a/src/app/history/controllers/HistoryController.php b/src/app/history/controllers/HistoryController.php
index 5bbefb36b1a69d01ad74effab0f5920c95aa0dea..338cfa3c0bf40e361c9e444634c8d52c1ea1ceae 100644
--- a/src/app/history/controllers/HistoryController.php
+++ b/src/app/history/controllers/HistoryController.php
@@ -434,7 +434,7 @@ class HistoryController
         }
 
         $queryParams = $request->getQueryParams();
-        if (!empty($queryParams['onlyProof']) && (empty($queryParams['onlyProof']) || empty($proofDocument))) {
+        if (empty($queryParams['onlyProof']) || empty($proofDocument)) {
             $formattedHistory = HistoryController::getFormattedHistory(['id' => $args['id']]);
             $historyXml       = HistoryController::arrayToXml(['data' => $formattedHistory['formattedHistory'], 'xml' => false]);
             $historyXmlPath = $tmpPath . 'maarchProof' . $GLOBALS['id'] . "_" . rand() . '.xml';
@@ -496,7 +496,8 @@ class HistoryController
                 }
             }
         }
-        if (!empty($queryParams['onlyProof']) && !$queryParams['onlyProof']) {
+        if (empty($queryParams['onlyProof'])) {
+            $contentType = null;
             if ($workflowCompleted && ($queryParams['eSignDocument'] ?? $hasCertificate)) {
                 $contentType = 'ESIGN';
             }
@@ -577,7 +578,7 @@ class HistoryController
         if (empty($queryParams['mode']) || $queryParams['mode'] == 'base64') {
             return $response->withJson(['encodedProofDocument' => base64_encode($content), 'format' => $format]);
         } else {
-            $response->write($content ?? '');
+            $response->write($content);
             $response = $response->withAddedHeader('Content-Disposition', "inline; filename=maarch_history_proof." . $format);
             return $response->withHeader('Content-Type', $mimeType);
         }
@@ -590,7 +591,6 @@ class HistoryController
         $tmpPath     = CoreConfigModel::getTmpPath();
         $zipFilename = $tmpPath . 'archivedProof' . $GLOBALS['id'] . '_' . rand() . '.zip';
 
-        if (empty($zipFilename)) 
  
         if ($zip->open($zipFilename, \ZipArchive::CREATE) === true) {
             foreach ($aArgs['documents'] as $document) {