--- /Users/hansnilsson/Downloads/Drupal/5.x/_patches/similarterms.module	2008-07-19 04:37:33.000000000 +0200
+++ /Users/hansnilsson/Downloads/Drupal/5.x/_patches/similarterms_new.module	2008-10-10 11:31:28.000000000 +0200
@@ -52,6 +52,7 @@
         '#multiple' => TRUE
       );
       if ($delta > 0) {
+        $terms = array();
         $tree = taxonomy_get_tree($delta);
         foreach ($tree as $term) {
           $terms[$term->tid] = $term->name;
@@ -123,7 +124,7 @@
       //past events
       $pasts = array();
       $types = variable_get('simterms_sametype_'. $vocid, false);
-      if (($types !== false) && is_array($types) && ($types['0'] == NULL) ) {
+      if (($types !== false) && is_array($types) && count($types) > 0 && ($types['0'] == NULL) ) {
         if ($types[1]) {
           $node_obj = node_load($nid);
           $types[1] = $node_obj->type;
