diff --git a/include/ajax.search.php b/include/ajax.search.php
index f0933380e0505e8417fbeb9cf32a49f3d672b477..5ef597a5538b51acb77d724ba09da84e46d435e2 100644
--- a/include/ajax.search.php
+++ b/include/ajax.search.php
@@ -63,7 +63,7 @@ class SearchAjaxAPI extends AjaxController {
         $search = SavedSearch::create(array('root'=>'T'));
         $searchable = $search->getSupportedMatches();
         if (!($F = $searchable[$name]))
-            Http::response(404, 'No such field: ', print_r($id, true));
+            Http::response(404, 'No such field: ', print_r($name, true));
 
         $fields = SavedSearch::getSearchField($F, $name);
         $form = new AdvancedSearchForm($fields);
@@ -101,7 +101,6 @@ class SearchAjaxAPI extends AjaxController {
     }
 
     function _setupSearch(SavedSearch $search, $form, $key='advsearch') {
-        $form = $search->getForm($vars);
         if ($this->_hasErrors($search, $form))
             return false;
 
diff --git a/include/class.search.php b/include/class.search.php
index 1597b063f4fd8cf13b19ebdfcedacfd5b67907cd..c89234029c212965d5059d628b3aa7f144507d59 100644
--- a/include/class.search.php
+++ b/include/class.search.php
@@ -769,9 +769,6 @@ class SavedSearch extends VerySimpleModel {
             $fields = array_merge($fields, self::getSearchField($field, $path));
         }
 
-        // Don't send the state as the souce because it is not in the
-        // ::parse format (it's in ::to_php format). Instead, source is set
-        // via ::loadState() below
         $form = new AdvancedSearchForm($fields, $source);
         $form->addValidator(function($form) {
             $selected = 0;