diff --git a/contrib/current_search/plugins/current_search/item.inc b/contrib/current_search/plugins/current_search/item.inc
index 170a815..0af2414 100644
--- a/contrib/current_search/plugins/current_search/item.inc
+++ b/contrib/current_search/plugins/current_search/item.inc
@@ -193,7 +193,7 @@ abstract class CurrentSearchItem {
     }
     else {
       return array(
-        '#markup' => '<p>' . t('Install the <a href="http://drupal.org/project/token" target="_blank" title="Token module project page">Token</a> module to view available replacement patterns.') . '</p>'
+        '#value' => '<p>' . t('Install the <a href="http://drupal.org/project/token" target="_blank" title="Token module project page">Token</a> module to view available replacement patterns.') . '</p>'
       );
     }
   }
diff --git a/contrib/current_search/plugins/current_search/item_group.inc b/contrib/current_search/plugins/current_search/item_group.inc
index a6b3542..0b6da5c 100644
--- a/contrib/current_search/plugins/current_search/item_group.inc
+++ b/contrib/current_search/plugins/current_search/item_group.inc
@@ -46,7 +46,7 @@ class CurrentSearchGroup extends CurrentSearchItem {
       // Builds list items.
       foreach ($group as $item) {
         $markup = $adapter->getMappedValue($item['facets'][0], $item['value']);
-        $text = ($markup['#html']) ? $markup['#markup'] : check_plain($markup['#markup']);
+        $text = ($markup['#html']) ? $markup['#value'] : check_plain($markup['#value']);
         $variables = array(
           'text' => $text,
           'path' => $this->getFacetPath($item, $adapter),
@@ -66,7 +66,7 @@ class CurrentSearchGroup extends CurrentSearchItem {
         // Performs token replacemenets and themes the group title.
         $data = array('facetapi_facet' => facetapi_facet_load($facet_name, $searcher));
         $title = filter_xss(token_replace($field_pattern, $data));
-        $build[$facet_name]['title']['#markup'] = theme('current_search_group_title', array('title' => $title));
+        $build[$facet_name]['title']['#value'] = theme('current_search_group_title', array('title' => $title));
 
         // Builds the list.
         $build[$facet_name]['list'] = array(
diff --git a/contrib/current_search/plugins/current_search/item_text.inc b/contrib/current_search/plugins/current_search/item_text.inc
index a0eae4f..229e477 100644
--- a/contrib/current_search/plugins/current_search/item_text.inc
+++ b/contrib/current_search/plugins/current_search/item_text.inc
@@ -36,7 +36,7 @@ class CurrentSearchItemText extends CurrentSearchItem {
       'class' => current_search_get_classes($this->settings['classes'], $data),
       'options' => array('html' => TRUE),
     );
-    return array('#markup' => theme('current_search_text', $variables));
+    return array('#value' => theme('current_search_text', $variables));
   }
 
   /**
diff --git a/contrib/current_search/plugins/export_ui/current_search_export_ui.class.php b/contrib/current_search/plugins/export_ui/current_search_export_ui.class.php
index 4a66ccd..34d3a41 100644
--- a/contrib/current_search/plugins/export_ui/current_search_export_ui.class.php
+++ b/contrib/current_search/plugins/export_ui/current_search_export_ui.class.php
@@ -249,7 +249,7 @@ function current_search_settings_form(&$form, &$form_state) {
   $form['description'] = array(
     '#prefix' => '<div class="current-search-description">',
     '#suffix' => '</div>',
-    '#markup' => $description,
+    '#value' => $description,
     '#weight' => -90,
   );
 
@@ -342,7 +342,7 @@ function current_search_settings_form(&$form, &$form_state) {
   // Builds checkbox options and weight dropboxes.
   foreach ($item->settings['items'] as $name => $settings) {
     $form['plugin_sort'][$name]['item'] = array(
-      '#markup' => check_plain($settings['label']),
+      '#value' => check_plain($settings['label']),
     );
     $form['plugin_sort'][$name]['remove'] = array(
       '#type' => 'link',
@@ -567,7 +567,7 @@ function current_search_delete_item_form(&$form_state, stdClass $item, $name) {
   );
 
   $form['text'] = array(
-   '#markup' => '<p>' . t('Are you sure you want to remove the item %name from the current search block configuration?.', array('%name' => $name)) . '</p>',
+   '#value' => '<p>' . t('Are you sure you want to remove the item %name from the current search block configuration?.', array('%name' => $name)) . '</p>',
   );
 
   $form['actions']['submit'] = array(
diff --git a/facetapi.admin.inc b/facetapi.admin.inc
index 8bcd7b1..26ddb38 100644
--- a/facetapi.admin.inc
+++ b/facetapi.admin.inc
@@ -44,7 +44,7 @@ function facetapi_realm_settings_form(&$form_state, $searcher, $realm_name) {
 
   $form['description'] = array(
     '#prefix' => '<div class="facetapi-realm-description">',
-    '#markup' => filter_xss_admin($realm['description']),
+    '#value' => filter_xss_admin($realm['description']),
     '#suffix' => "</div>\n",
   );
 
@@ -236,7 +236,7 @@ function theme_facetapi_realm_settings_table($variables) {
 
   $header = array(
     'enabled' => array('data' => t('Enabled')),
-    'label' => array('data' => t('Facet')),
+    'label' => array('data' => t('Facet'), 'sort' => 'asc'),
     'operations' => array('data' => t('Operations')),
   );
   if ($realm['sortable']) {
@@ -694,7 +694,7 @@ function theme_facetapi_sort_settings_table($variables) {
     'active' => array(),
     'label' => array('data' => t('Sort')),
     'order' => array('data' => t('Order')),
-    'weight' => array('data' => t('Weight')),
+    'weight' => array('data' => t('Weight'), 'sort' => 'asc'),
   );
 
   // Builds field options.
@@ -879,7 +879,7 @@ function facetapi_facet_filters_form(&$form_state, FacetapiAdapter $adapter, arr
       '#parents' => array('settings', 'filters', $id, 'status'),
     );
     $form['settings']['filters']['table'][$id]['filter'] = array(
-      '#markup' => filter_xss_admin($plugin['handler']['label']),
+      '#value' => filter_xss_admin($plugin['handler']['label']),
     );
     $form['settings']['filters']['table'][$id]['weight'] = array(
       '#type' => 'weight',
@@ -977,9 +977,9 @@ function theme_facetapi_filter_settings_table($variables) {
 
 // Initializes table header.
   $header = array(
-    'status' => t('Status'),
-    'filter' => t('Filter'),
-    'weight' => t('Weight'),
+    'status' => array('data' => t('Status')),
+    'filter' => array('data' => t('Filter')),
+    'weight' => array('data' => t('Weight'), 'sort' => 'asc'),
   );
   // Filter order (tabledrag).
   $rows = array();
@@ -1065,7 +1065,7 @@ function facetapi_facet_dependencies_form(&$form_state, FacetapiAdapter $adapter
 
   $form['description'] = array(
     '#prefix' => '<div class="facetapi-realm-description">',
-    '#markup' => t('Dependencies are conditions that must be met in order for the facet to be processed by the server and displayed to the user. Hiding facets via the core block system or through the Drupal forms API will not prevent the server from processing the facets.'),
+    '#value' => t('Dependencies are conditions that must be met in order for the facet to be processed by the server and displayed to the user. Hiding facets via the core block system or through the Drupal forms API will not prevent the server from processing the facets.'),
     '#suffix' => "</div>\n",
   );
 
@@ -1228,7 +1228,7 @@ function facetapi_revert_form(&$form_state, FacetapiAdapter $adapter, array $rea
   );
 
   $form['text'] = array(
-   '#markup' => '<p>' . t('Any changes you have made will be lost and cannot be recovered.') . '</p>',
+   '#value' => '<p>' . t('Any changes you have made will be lost and cannot be recovered.') . '</p>',
   );
 
   $form['revert_facet'] = array(
diff --git a/facetapi.tokens.inc b/facetapi.tokens.inc
index 5462466..82f8482 100644
--- a/facetapi.tokens.inc
+++ b/facetapi.tokens.inc
@@ -176,7 +176,7 @@ function facetapi_tokens($type, $tokens, array $data = array(), array $options =
 
         case 'active-value':
           $markup = $adapter->getMappedValue($item['facets'][0], $item['value']);
-          $text = empty($markup['#html']) ? check_plain($markup['#markup']) : $markup['#markup'];
+          $text = empty($markup['#html']) ? check_plain($markup['#value']) : $markup['#value'];
           $replacements[$original] = $text;
           break;
 
diff --git a/plugins/facetapi/adapter.inc b/plugins/facetapi/adapter.inc
index d7f4e79..4de4934 100644
--- a/plugins/facetapi/adapter.inc
+++ b/plugins/facetapi/adapter.inc
@@ -716,7 +716,7 @@ abstract class FacetapiAdapter {
       return $this->processors[$facet_name]->getMappedValue($value);
     }
     else {
-      return array('#markup' => $value);
+      return array('#value' => $value);
     }
   }
 
@@ -1180,7 +1180,7 @@ class FacetapiFacetProcessor {
    *   The mapped value.
    */
   public function getMappedValue($value) {
-    return (isset($this->map[$value])) ? $this->map[$value] : array('#markup' => $value);
+    return (isset($this->map[$value])) ? $this->map[$value] : array('#value' => $value);
   }
 
   /**
@@ -1194,7 +1194,7 @@ class FacetapiFacetProcessor {
 
     // Build array defaults.
     $defaults = array(
-      '#markup' => '',
+      '#value' => '',
       '#path' => $this->facet->getAdapter()->getSearchPath(),
       '#html' => FALSE,
       '#indexed_value' => '',
@@ -1216,7 +1216,7 @@ class FacetapiFacetProcessor {
     // Iterates over the render array and merges in defaults.
     foreach (element_children($build) as $value) {
       $item_defaults = array(
-        '#markup' => $value,
+        '#value' => $value,
         '#indexed_value' => $value,
         '#active' => $adapter->itemActive($this->facet['name'], $value),
       );
@@ -1246,11 +1246,11 @@ class FacetapiFacetProcessor {
         foreach ($this->map as $key => $value) {
           if (!is_array($value)) {
             $this->map[$key] = array();
-            $this->map[$key]['#markup'] = $value;
+            $this->map[$key]['#value'] = $value;
             $this->map[$key]['#html'] = FALSE;
           }
           if (isset($build[$key])) {
-            $build[$key]['#markup'] = $this->map[$key]['#markup'];
+            $build[$key]['#value'] = $this->map[$key]['#value'];
             $build[$key]['#html'] = !empty($this->map[$key]['#html']);
           }
         }
diff --git a/plugins/facetapi/empty_behavior_text.inc b/plugins/facetapi/empty_behavior_text.inc
index 0d1235e..5160194 100644
--- a/plugins/facetapi/empty_behavior_text.inc
+++ b/plugins/facetapi/empty_behavior_text.inc
@@ -32,7 +32,7 @@ class FacetapiEmptyBehaviorText extends FacetapiEmptyBehavior {
   public function execute() {
     $format_id = $this->settings['empty_text']['format'];
     $text = $this->translate('empty_text', $this->settings['empty_text']['value']);
-    return array('#markup' => check_markup($text, $format_id));
+    return array('#value' => check_markup($text, $format_id));
   }
 
   /**
diff --git a/plugins/facetapi/url_processor_standard.inc b/plugins/facetapi/url_processor_standard.inc
index 99a989a..3ef731a 100644
--- a/plugins/facetapi/url_processor_standard.inc
+++ b/plugins/facetapi/url_processor_standard.inc
@@ -40,7 +40,7 @@ class FacetapiUrlProcessorStandard extends FacetapiUrlProcessor {
       }
 
       if (is_array($value)) {
-        $params[$key] = drupal_get_query_parameters($value, $exclude, $string_key);
+        $params[$key] = $this->fetchQueryParams($value, $exclude, $string_key);
       }
       else {
         $params[$key] = $value;
@@ -123,11 +123,11 @@ class FacetapiUrlProcessorStandard extends FacetapiUrlProcessor {
 
       // The last item should be text, not a link.
       if ($last == $item) {
-        $breadcrumb[] = !empty($value['#html']) ? $value['#markup'] : check_plain($value['#markup']);
+        $breadcrumb[] = !empty($value['#html']) ? $value['#value'] : check_plain($value['#value']);
       }
       else {
         // Appends the filter to the breadcrumb trail.
-        $breadcrumb[] = l($value['#markup'], $_GET['q'], array('query' => $query, 'html' => !empty($value['#html'])));
+        $breadcrumb[] = l($value['#value'], $_GET['q'], array('query' => $query, 'html' => !empty($value['#html'])));
       }
     }
 
diff --git a/plugins/facetapi/widget.inc b/plugins/facetapi/widget.inc
index eff5245..7eb02cc 100644
--- a/plugins/facetapi/widget.inc
+++ b/plugins/facetapi/widget.inc
@@ -291,7 +291,7 @@ function facetapi_sort_indexed(array $a, array $b) {
  * Sorts by display value.
  */
 function facetapi_sort_display(array $a, array $b) {
-  $a_count = (isset($a['#markup'])) ? $a['#markup'] : '';
-  $b_count = (isset($b['#markup'])) ? $b['#markup'] : '';
-  return strcasecmp($a['#markup'], $b['#markup']);
+  $a_count = (isset($a['#value'])) ? $a['#value'] : '';
+  $b_count = (isset($b['#value'])) ? $b['#value'] : '';
+  return strcasecmp($a['#value'], $b['#value']);
 }
diff --git a/plugins/facetapi/widget_links.inc b/plugins/facetapi/widget_links.inc
index 5fdb6fb..00adfe7 100644
--- a/plugins/facetapi/widget_links.inc
+++ b/plugins/facetapi/widget_links.inc
@@ -80,7 +80,7 @@ class FacetapiWidgetLinks extends FacetapiWidget {
 
       // Initializes variables passed to theme hook.
       $variables = array(
-        'text' => $item['#markup'],
+        'text' => $item['#value'],
         'path' => $item['#path'],
         'count' => $item['#count'],
         'options' => array(
diff --git a/tests/facetapi.test b/tests/facetapi.test
index ab93c30..dea7a0c 100644
--- a/tests/facetapi.test
+++ b/tests/facetapi.test
@@ -24,6 +24,8 @@ class FacetapiTestCase extends DrupalWebTestCase {
       'administer search',
       'access administration pages',
     ));
+    // Needed for the autoload of the classes within simpletest
+    autoload_registry_rebuild();
   }
 
   /**
@@ -95,11 +97,12 @@ class FacetapiTestCase extends DrupalWebTestCase {
 
       // Generates the "key" by generating and hashing the delta.
       module_load_include('inc', 'facetapi', 'facetapi.block');
-      $detla = facetapi_build_delta('facetapi_test', $realm_name, $facet_name);
-      $key = 'facetapi_' . facetapi_hash_delta($detla);
+      $delta = facetapi_build_delta('facetapi_test', $realm_name, $facet_name);
+      $key = 'facetapi_' . facetapi_hash_delta($delta);
 
-      // Enables the facet in the "sidebar_first" region.
-      $edit = array('blocks[' . $key . '][region]' => 'sidebar_first');
+      // Set the created block to a specific region.
+      $edit = array();
+      $edit[$key .'[region]'] = 'right';
       $this->drupalPost('admin/build/block', $edit, t('Save blocks'));
 
       // Visits search page, raw value mimics return from default theme function.
@@ -108,6 +111,15 @@ class FacetapiTestCase extends DrupalWebTestCase {
       $this->assertRaw($raw, t('Facet block displayed on search page.'));
     }
   }
+
+  protected function assertUrl($path, array $options = array(), $message = '', $group = 'Other') {
+    if (!$message) {
+      $url = url($path, $options);
+      $message = t('Current URL is @url.', array('@url' => $url));
+    }
+    $options['absolute'] = TRUE;
+    return $this->assertEqual($this->getUrl(), url($path, $options), $message, $group);
+  }
 }
 
 class FacetapiAdapterTestCase extends FacetapiTestCase {
@@ -191,7 +203,7 @@ class FacetapiAdminInterfaceTestCase extends FacetapiTestCase {
     // Searches for "block" link in description.
     $description = t(
       'The <em>Blocks</em> realm displays each facet in a separate <a href="@block-page">block</a>. Users are able to refine their searches in a drill-down fashion.',
-      array('@block-page' => url('admin/structure/block', array('query' => array('destination' => 'admin/settings/facetapi_test/facets/block'))))
+      array('@block-page' => url('admin/build/block', array('query' => array('destination' => 'admin/settings/facetapi_test/facets/block'))))
     );
     $this->drupalGet('admin/settings/facetapi_test/facets/block');
     $this->assertRaw($description, t('Facet API test facet form exists.'));
diff --git a/tests/facetapi_test.info b/tests/facetapi_test.info
index dcba4b0..eb88fcd 100644
--- a/tests/facetapi_test.info
+++ b/tests/facetapi_test.info
@@ -2,5 +2,5 @@ name = Facet API Test
 description = Provides a test adapter and plugins.
 dependencies[] = facetapi
 package = Testing
-core = 7.x
+core = 6.x
 hidden = TRUE
diff --git a/tests/facetapi_test.module b/tests/facetapi_test.module
index bab177a..6b9c28d 100644
--- a/tests/facetapi_test.module
+++ b/tests/facetapi_test.module
@@ -90,7 +90,9 @@ function facetapi_test_facetapi_searcher_info() {
  */
 function facetapi_test_admin_settings(&$form_state) {
   $form = array();
-  $form['text'] = array('#markup' => FACETAPI_TEST_FORM_TEXT);
+  $form['text'] = array(
+    '#value' => FACETAPI_TEST_FORM_TEXT,
+  );
   return $form;
 }
 
@@ -139,7 +141,7 @@ function facetapi_test_search_callback() {
   $adapter->setSearchKeys($keys);
 
   $build['placeholder'] = array(
-    '#markup' => t('Placeholder'),
+    '#value' => t('Placeholder'),
   );
 
   return $build;
