diff --git a/.liquibase/_____SYSTEMALIAS/basic/init/init.xml b/.liquibase/_____SYSTEMALIAS/basic/init/init.xml
index 540e5ac07739f0524bb0296de3a9505762c3ee0e..a3ef4613451926ada644d4490e2b18bb421235b2 100644
--- a/.liquibase/_____SYSTEMALIAS/basic/init/init.xml
+++ b/.liquibase/_____SYSTEMALIAS/basic/init/init.xml
@@ -1,5 +1,7 @@
 <?xml version="1.1" encoding="UTF-8" standalone="no"?>
 <databaseChangeLog xmlns="http://www.liquibase.org/xml/ns/dbchangelog" xmlns:ext="http://www.liquibase.org/xml/ns/dbchangelog-ext" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://www.liquibase.org/xml/ns/dbchangelog-ext http://www.liquibase.org/xml/ns/dbchangelog/dbchangelog-ext.xsd http://www.liquibase.org/xml/ns/dbchangelog http://www.liquibase.org/xml/ns/dbchangelog/dbchangelog-3.6.xsd">
+    
+    <include relativeToChangelogFile="true" file="struct/create_asys_audit.xml"/>
     <include relativeToChangelogFile="true" file="struct/create_asys_aliasconfig.xml"/>
     <include relativeToChangelogFile="true" file="struct/create_asys_binaries.xml"/>
     <include relativeToChangelogFile="true" file="struct/create_asys_dashletconfigurations.xml"/>
@@ -29,5 +31,6 @@
     <include relativeToChangelogFile="true" file="data/insert_asys_system.xml"/>
     <include relativeToChangelogFile="true" file="data/insert_asys_permissionset.xml"/>
     <include relativeToChangelogFile="true" file="data/insert_asys_permission.xml"/>
-    <include relativeToChangelogFile="true" file="data/insert_asys_permissionaction.xml"/>
+    <include relativeToChangelogFile="true" file="data/insert_asys_permissionaction.xml"/> 
+   
 </databaseChangeLog>
diff --git a/.liquibase/_____SYSTEMALIAS/basic/init/struct/create_asys_audit.xml b/.liquibase/_____SYSTEMALIAS/basic/init/struct/create_asys_audit.xml
new file mode 100644
index 0000000000000000000000000000000000000000..925f1cc139a3ab4128915d07d41d925f05aca4cd
--- /dev/null
+++ b/.liquibase/_____SYSTEMALIAS/basic/init/struct/create_asys_audit.xml
@@ -0,0 +1,21 @@
+<?xml version="1.1" encoding="UTF-8" standalone="no"?>
+<databaseChangeLog xmlns="http://www.liquibase.org/xml/ns/dbchangelog" xmlns:ext="http://www.liquibase.org/xml/ns/dbchangelog-ext" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://www.liquibase.org/xml/ns/dbchangelog-ext http://www.liquibase.org/xml/ns/dbchangelog/dbchangelog-ext.xsd http://www.liquibase.org/xml/ns/dbchangelog http://www.liquibase.org/xml/ns/dbchangelog/dbchangelog-3.6.xsd">
+<changeSet author="m.schloder" id="Xcb1ff99-55bd-4ebc-8137-ec05b4cacbd7">
+    <createTable tableName="ASYS_AUDIT">
+        <column name="ACOLUMNNAME" type="VARCHAR(217)"/>
+		<column name="ALIAS" type="VARCHAR(255)"/>
+		<column name="ATABLENAME" type="VARCHAR(127)"/>
+		<column name="ATIMESTAMP" type="DATETIME"/>
+		<column name="AUSER" type="VARCHAR(255)"/>
+		<column name="DATASETID" type="VARCHAR(1023)"/>
+		<column name="DATASETNEWVALUE_BLOB" type="LONGBLOB"/>
+		<column name="DATASETNEWVALUE_CLOB" type="TEXT"/>
+		<column name="DATASETNEWVALUE_STRING" type="VARCHAR(1023)"/>
+		<column defaultValueComputed="CURRENT_TIMESTAMP" name="LOGTIME" type="TIMESTAMP" />
+		<column name="LOGTYPE" type="INT"/>
+		<column name="LOGWRITERUID" type="VARCHAR(127)"/>
+		<column name="SQLACTION" type="CHAR(1)"/>  
+    </createTable>
+     
+    </changeSet>
+</databaseChangeLog>
\ No newline at end of file
diff --git a/process/Email_lib/process.js b/process/Email_lib/process.js
index 2bb2c3d1239b1458fed124790bb58827b0f15fab..93e6008b16eefca9f3f8bd1efe82fa973fcf27c9 100644
--- a/process/Email_lib/process.js
+++ b/process/Email_lib/process.js
@@ -41,15 +41,19 @@ EmailWritingUtils.openMailTemplate = function (pToRecipients, pSenderContactId,
     if (pToRecipients && typeof(pToRecipients) == "string")
         pToRecipients = [pToRecipients];
     
-    var email;
+    var email, retVal, isBinaryExistent;
+    isBinaryExistent = db.getBinaryCount("DOCUMENTTEMPLATE", "DOCUMENT", pTemplateId, SqlUtils.getBinariesAlias(), null);
     
-    if (pTemplateId || (pBindata.bindata != "" && pBindata.bindata != null))
+    if ((pTemplateId && isBinaryExistent > 0) || (pBindata.bindata != "" && pBindata.bindata != null))
     {
         email = Email.fromTemplate(pTemplateId, pRecipientContactId, pBindata, pAdditionalPlaceholders);
         if (!email)
             email = new Email();
     }    
-    else email = new Email();
+    else 
+    {
+        email = new Email();
+    }
     
     email.setSender(pSenderContactId);
     
@@ -72,9 +76,7 @@ EmailWritingUtils.openMailTemplate = function (pToRecipients, pSenderContactId,
         email.subject = pSubject;
     }
     
-    var isBinaryExistent = db.getBinaryCount("DOCUMENTTEMPLATE", "DOCUMENT", pTemplateId, SqlUtils.getBinariesAlias(), null);
-    
-    return isBinaryExistent > 0 ? email.downloadEML(pEmailFilename) : [];
+    return email.downloadEML(pEmailFilename);
 }