diff --git a/better_exposed_filters.js b/better_exposed_filters.js
index 2639626..df19e7e 100644
--- a/better_exposed_filters.js
+++ b/better_exposed_filters.js
@@ -20,7 +20,7 @@
             // Select all the checkboxes
             $(this)
               .html(selNone)
-              .siblings('.bef-checkboxes')
+              .siblings('.bef-checkboxes, .bef-tree')
                 .find('.form-item input:checkbox').each(function() {
                   $(this).attr('checked', 'checked');
                 })
@@ -35,7 +35,7 @@
             // Unselect all the checkboxes
             $(this)
               .html(selAll)
-              .siblings('.bef-checkboxes')
+              .siblings('.bef-checkboxes, .bef-tree')
                 .find('.form-item input:checkbox').each(function() {
                   $(this).attr('checked', '');
                 })
@@ -56,7 +56,7 @@
             // Clone the link prototype and insert into the DOM
             var newLink = link.clone(true);
             
-            newLink.insertBefore($('.bef-checkboxes', this));
+            newLink.insertBefore($('.bef-checkboxes, .bef-tree', this));
             
             // If all checkboxes are already checked by default then switch to Select None
             if ($('input:checkbox:checked', this).length == $('input:checkbox', this).length) {
diff --git a/better_exposed_filters.theme b/better_exposed_filters.theme
index e326d61..5070d2e 100644
--- a/better_exposed_filters.theme
+++ b/better_exposed_filters.theme
@@ -43,6 +43,7 @@ function theme_select_as_checkboxes_fieldset($vars) {
 function theme_select_as_checkboxes($vars) {
   $element = $vars['element'];
   if (!empty($element['#bef_nested'])) {
+    $element['#attributes']['class'] .= ' form-checkboxes';
     return theme('select_as_tree', array('element' => $element));
   }
   
@@ -314,7 +315,7 @@ function theme_select_as_tree($vars) {
   $output .= '</ul>';
   
   // Add exposed filter description
-  $class = (isset($element['#attributes']['class']) ? $element['#attributes']['class'] : '');
+  $class = (isset($element['#attributes']['class']) ? 'class="' . $element['#attributes']['class'] . '"' : '');
   $description = '';
   if (!empty($element['#description'])) {
     $description = '<div class="description">'. $element['#description'] .'</div>';
