diff --git a/include/class.topic.php b/include/class.topic.php
index c415b157aa1e0cf063ae7d912cd2905b1e90dfd9..ee0f2a47ede9eab61d87bf0955c5aec9fcd8bd30 100644
--- a/include/class.topic.php
+++ b/include/class.topic.php
@@ -351,7 +351,9 @@ class Topic {
         } else {
             if (isset($vars['topic_id']))
                 $sql .= ', topic_id='.db_input($vars['topic_id']);
-            if ($vars['topic_pid'] && $cfg->getTopicSortMode() != 'a') {
+            // If in manual sort mode, place the new item directly below the
+            // parent item
+            if ($vars['topic_pid'] && $cfg && $cfg->getTopicSortMode() != 'a') {
                 $sql .= ', `sort`='.db_input(
                     db_result(db_query('SELECT COALESCE(`sort`,0)+1 FROM '.TOPIC_TABLE
                         .' WHERE `topic_id`='.db_input($vars['topic_pid']))));
@@ -363,7 +365,7 @@ class Topic {
             else
                 $errors['err']='Unable to create the topic. Internal error';
         }
-        if ($cfg->getTopicSortMode() == 'a') {
+        if (!$cfg || $cfg->getTopicSortMode() == 'a') {
             static::updateSortOrder();
         }
         return $rv;
@@ -371,7 +373,9 @@ class Topic {
 
     static function updateSortOrder() {
         // Fetch (un)sorted names
-        $names = static::getHelpTopics(false, true);
+        if (!($names = static::getHelpTopics(false, true)))
+            return;
+
         uasort($names, function($a, $b) { return strcmp($a, $b); });
 
         $update = array_keys($names);
diff --git a/include/i18n/en_US/help_topic.yaml b/include/i18n/en_US/help_topic.yaml
index 508590a57c34ebff19f1be5ad74aa2d85f142669..ee9e9aa40d338657fa74f4f4ce735bc1163d6fb2 100644
--- a/include/i18n/en_US/help_topic.yaml
+++ b/include/i18n/en_US/help_topic.yaml
@@ -43,7 +43,7 @@
   notes: |
     Product, service, or equipment related issues
 
-- pid: 10
+- topic_pid: 10
   isactive: 1
   ispublic: 1
   dept_id: 1