--- comment.module
+++ comment.module
@@ -720,7 +720,7 @@
           $max = rtrim($max, '/');
 
           // Finally, build the thread field for this new comment.
-          $thread = int2vancode(vancode2int($max) + 1) .'/';
+          $edit['thread'] = int2vancode(vancode2int($max) + 1) .'/';
         }
         else {
           // This is comment with a parent comment: we increase
@@ -737,7 +737,7 @@
 
           if ($max == '') {
             // First child of this parent.
-            $thread = $parent->thread .'.'. int2vancode(0) .'/';
+            $edit['thread'] = $parent->thread .'.'. int2vancode(0) .'/';
           }
           else {
             // Strip the "/" at the end of the thread.
@@ -749,7 +749,7 @@
             $last = $parts[$parent_depth];
 
             // Finally, build the thread field for this new comment.
-            $thread = $parent->thread .'.'. int2vancode(vancode2int($last) + 1) .'/';
+            $edit['thread'] = $parent->thread .'.'. int2vancode(vancode2int($last) + 1) .'/';
           }
         }
 
@@ -761,7 +761,7 @@
           $edit['name'] = $user->name;
         }
 
-        db_query("INSERT INTO {comments} (nid, pid, uid, subject, comment, format, hostname, timestamp, status, thread, name, mail, homepage) VALUES (%d, %d, %d, '%s', '%s', %d, '%s', %d, %d, '%s', '%s', '%s', '%s')", $edit['nid'], $edit['pid'], $edit['uid'], $edit['subject'], $edit['comment'], $edit['format'], ip_address(), $edit['timestamp'], $edit['status'], $thread, $edit['name'], $edit['mail'], $edit['homepage']);
+        db_query("INSERT INTO {comments} (nid, pid, uid, subject, comment, format, hostname, timestamp, status, thread, name, mail, homepage) VALUES (%d, %d, %d, '%s', '%s', %d, '%s', %d, %d, '%s', '%s', '%s', '%s')", $edit['nid'], $edit['pid'], $edit['uid'], $edit['subject'], $edit['comment'], $edit['format'], ip_address(), $edit['timestamp'], $edit['status'], $edit['thread'], $edit['name'], $edit['mail'], $edit['homepage']);
         $edit['cid'] = db_last_insert_id('comments', 'cid');
 
         // Tell the other modules a new comment has been submitted.
