diff --git a/include/class.dept.php b/include/class.dept.php
index 2bc2f30b3470beada4e89d15fe46072ee5ad1d69..8f1542b737d631a07024a6303dd80516963c5f28 100644
--- a/include/class.dept.php
+++ b/include/class.dept.php
@@ -355,7 +355,7 @@ class Dept {
                 && (!$vars['email_id'] || !is_numeric($vars['email_id'])))
             $errors['email_id']='Email selection required';
 
-        if(!is_numeric($vars['tpl_id']))
+        if(isset($vars['tpl_id']) && !is_numeric($vars['tpl_id']))
             $errors['tpl_id']='Template selection required';
 
         if(!$vars['name']) {
diff --git a/include/class.mailer.php b/include/class.mailer.php
index 36bd1a4b652083208c63851e4dab744861bc71af..0e89ddad588bb0a4b00e210ada0bde36abe90fd9 100644
--- a/include/class.mailer.php
+++ b/include/class.mailer.php
@@ -141,7 +141,7 @@ class Mailer {
         // the message appears to be HTML -- that is, the first
         // non-whitespace char is a '<' character
         if (!(isset($options['text']) && $options['text'])
-                && $cfg->isHtmlThreadEnabled()) {
+                && (!$cfg || $cfg->isHtmlThreadEnabled())) {
             // Make sure nothing unsafe has creeped into the message
             $message = Format::safe_html($message); //XXX??
             $mime->setTXTBody(Format::html2text($message, 90, false));
@@ -152,7 +152,7 @@ class Mailer {
         }
 
         $domain = 'local';
-        if ($isHtml && $ost->getConfig()->isHtmlThreadEnabled()) {
+        if ($isHtml && $cfg && $cfg->isHtmlThreadEnabled()) {
             // TODO: Lookup helpdesk domain
             $domain = substr(md5($ost->getConfig()->getURL()), -12);
             // Format content-ids with the domain, and add the inline images
diff --git a/include/class.topic.php b/include/class.topic.php
index 881d33afaa980e510e3aacd8cddd9bcfa3adecc9..e4ac4c98cd2be7de94ea02a0e2aa5b7c6e2c1349 100644
--- a/include/class.topic.php
+++ b/include/class.topic.php
@@ -261,6 +261,8 @@ class Topic {
 
             $errors['err']='Unable to update topic. Internal error occurred';
         } else {
+            if (isset($vars['topic_id']))
+                $sql .= ', topic_id='.db_input($vars['topic_id']);
             $sql='INSERT INTO '.TOPIC_TABLE.' SET '.$sql.',created=NOW()';
             if(db_query($sql) && ($id=db_insert_id()))
                 return $id;
diff --git a/include/i18n/en_US/help_topic.yaml b/include/i18n/en_US/help_topic.yaml
index e002905d355e153b16338bd6a20c7afb96505cfd..508590a57c34ebff19f1be5ad74aa2d85f142669 100644
--- a/include/i18n/en_US/help_topic.yaml
+++ b/include/i18n/en_US/help_topic.yaml
@@ -34,7 +34,7 @@
   notes: |
     Tickets that primarily concern the sales and billing departments
 
-- id: 10
+- topic_id: 10
   isactive: 1
   ispublic: 1
   dept_id: 1