diff --git a/src/app/document/controllers/CertificateSignatureController.php b/src/app/document/controllers/CertificateSignatureController.php
index ae5de8d780d095d91bc44f08e47e126cfe16fb80..89b2da0957f1c0edc089d2e276a210affe14f71b 100755
--- a/src/app/document/controllers/CertificateSignatureController.php
+++ b/src/app/document/controllers/CertificateSignatureController.php
@@ -264,17 +264,15 @@ class CertificateSignatureController
             DigitalSignatureController::terminate(['config' => $config, 'transactionId' => $document['digital_signature_transaction_id']]);
         }
 
-
-        // if (!empty($storeInfos['errors'])) {
-        //     return ['errors' => $storeInfos['errors']];
-        // }
-
         if ($args['lastStep']) {
             $storeInfos = DocserverController::storeResourceOnDocServer([
                 'encodedFile'   => base64_encode(file_get_contents($signedDocumentPath)),
                 'format'        => 'pdf',
                 'docserverType' => 'ESIGN'
             ]);
+             if (!empty($storeInfos['errors'])) {
+                 return ['errors' => $storeInfos['errors']];
+             }
 
             AdrModel::deleteDocumentAdr([
                 'where' => ['main_document_id = ?', 'type = ?'],
diff --git a/src/app/document/controllers/DocumentController.php b/src/app/document/controllers/DocumentController.php
index 2f49e4dcc69f26fed50dd4818a7d2d527a3cc3d4..ce9f40eb1b090f2603eefc9a8a1f5147aeb1704d 100755
--- a/src/app/document/controllers/DocumentController.php
+++ b/src/app/document/controllers/DocumentController.php
@@ -1235,6 +1235,9 @@ class DocumentController
         ValidatorModel::stringType($args, ['path']);
 
         $tmpPath = CoreConfigModel::getTmpPath();
+        if (!is_dir($tmpPath)) {
+            return ['errors' => 'Tmp path is not valid'];
+        }
 
         $tmpFilename = $tmpPath . $GLOBALS['id'] . '_' . rand() . 'adr.pdf';
         copy($args['path'], $tmpFilename);