--- Thread.php	2005-01-03 14:09:07.000000000 +0100
+++ /usr/lib/php/Horde/IMAP/Thread.php	2005-02-10 12:23:59.000000000 +0100
@@ -10,7 +10,7 @@
  * did not receive this file, see http://www.fsf.org/copyleft/gpl.html.
  *
  * @author  Michael Slusarz <slusarz@curecanti.org>
- * @version $Revision: 1.5 $
+ * @version $Revision: 1.2 $
  * @since   Horde 3.0
  * @package Horde_IMAP
  */
@@ -93,7 +93,8 @@
      */
     function getThreadBase($index)
     {
-        if ($key = $this->_getKey($index)) {
+    	$key = $this->_getKey($index);
+        if (isset($key)) {
             if (!empty($this->_thread[$key]['base'])) {
                 return $this->_thread[$key]['base'];
             }
@@ -135,7 +136,7 @@
      */
     function _getKey($index)
     {
-        return (isset($this->_lookup[$index])) ? $this->_lookup[$index] : false;
+        return (isset($this->_lookup[$index])) ? $this->_lookup[$index] : null;
     }
 
     /**
@@ -165,17 +166,18 @@
     {
         /* Find the beginning of the thread. */
         $begin = $this->getThreadBase($index);
+        $key = $this->_getKey($begin);
         if (empty($begin) ||
-            !($key = $this->_getKey($begin))) {
+            !isset($key)) {
             return array($index);
         }
 
         /* Work forward from the first thread element to find the end of the
          * thread. */
         $thread_list = array($this->_thread[$key]['index']);
-        while ($key++) {
+        while (++$key) {
             if (!isset($this->_thread[$key])) {
-                break;
+                continue;
             }
             $curr = $this->_thread[$key];
             if ($curr['base'] == $begin) {