--- site_map/site_map.module	2008-02-08 07:21:59.000000000 +0000
+++ site_map.module.fixed	2008-03-09 04:13:01.000000000 +0000
@@ -477,22 +477,32 @@
   $output .= '<div class="tree">';
   // taxonomy_get_tree() honors access controls
   $tree = taxonomy_get_tree($vid);
+  
+  $indentation_string = ' ';
+  
   foreach ($tree as $term) {
+    $indent = str_repeat($indentation_string, $term->depth);
+    
     // Adjust the depth of the <ul> based on the change
     // in $term->depth since the $last_depth.
     if ($term->depth > $last_depth) {
       for ($i = 0; $i < ($term->depth - $last_depth); $i++) {
-        $output .= '<ul>';
+        $output .= "\n$indent<ul>\n";
       }
     }
+    else if ($term->depth == $last_depth) {
+      $output .= "</li>\n";
+    }
     else if ($term->depth < $last_depth) {
       for ($i = 0; $i < ($last_depth - $term->depth); $i++) {
-        $output .= '</ul>';
+        $output .= "</li>\n$indent</ul>\n</li>\n";
       }
     }
     // Display the $term.
-    $output .= '<li>';
+    $output .= "$indent<li>";
+
     $term->count = taxonomy_term_count_nodes($term->tid);
+
     if ($term->count) {
       if ($cat_depth < 0) {
         $output .= l($term->name, taxonomy_term_path($term), array('title' => $term->description));
@@ -511,10 +521,7 @@
       $output .= ' '. theme('site_map_feed_icon', url("taxonomy/term/$term->tid/$rss_depth/feed"));
       $output .= (module_exists('commentrss') ? ' '. theme('site_map_feed_icon', url("crss/term/$term->tid"), 'comment') : '');
     }
-
-
-
-    $output .= "</li>\n";
+    
     // Reset $last_depth in preparation for the next $term.
     $last_depth = $term->depth;
   }
@@ -522,7 +529,7 @@
   // Bring the depth back to where it began, -1.
   if ($last_depth > -1) {
     for ($i = 0; $i < ($last_depth + 1); $i++) {
-      $output .= '</ul>';
+      $output .= "</li>\n</ul>";
     }
   }
   $output .= "</div>\n";
