diff --git a/include/class.dept.php b/include/class.dept.php
index fe8ded86e6aba9c5371c6ea6b46e1e861d7bf62e..102e87030e48f0debdbb40e311f29a45938768c4 100644
--- a/include/class.dept.php
+++ b/include/class.dept.php
@@ -962,7 +962,7 @@ extends Form {
         );
     }
 
-    function getClean() {
+    function getClean($validate = true) {
         $clean = parent::getClean();
 
         $clean['ispublic'] = !$clean['private'];
diff --git a/include/class.dynamic_forms.php b/include/class.dynamic_forms.php
index 6b6212c6a278329cdec9ee089b083001ad7818a1..75c3e9904136dcab723426ed2159f6a07007fd23 100644
--- a/include/class.dynamic_forms.php
+++ b/include/class.dynamic_forms.php
@@ -1183,7 +1183,8 @@ class DynamicFormEntry extends VerySimpleModel {
     }
 
     function render($options=array()) {
-        $options += array('staff' => true);
+        if (is_array($options))
+            $options += array('staff' => true);
         return $this->getForm()->render($options);
     }
 
diff --git a/include/class.role.php b/include/class.role.php
index 7898bb9b67d424c3bbbb468c5a06bf44a7c24a2d..710c78da7ce79cd77ee6042872136a49e2eb4eb4 100644
--- a/include/class.role.php
+++ b/include/class.role.php
@@ -387,7 +387,7 @@ extends AbstractForm {
         );
     }
 
-    function getClean() {
+    function getClean($validate = true) {
         $clean = parent::getClean();
         // Index permissions as ['ticket.edit' => 1]
         $clean['perms'] = array_keys($clean['perms']);
diff --git a/include/class.search.php b/include/class.search.php
index e701a3f097c901a02e7973d5baa415ed51381865..f2a77955b536dd165f28a333ffbd7e261a314e0b 100755
--- a/include/class.search.php
+++ b/include/class.search.php
@@ -700,7 +700,8 @@ class SavedQueue extends CustomQueue {
         return $this->_columns;
     }
 
-    static function getHierarchicalQueues(Staff $staff) {
+    static function getHierarchicalQueues(Staff $staff, $pid=0,
+            $primary=true) {
         return CustomQueue::getHierarchicalQueues($staff, 0, false);
     }
 
diff --git a/include/class.staff.php b/include/class.staff.php
index 3833c63533505f740f8ca1da3ed13d494e9fec96..c02bdb342b525f9ff851b7b9bd70c4e2052d8f70 100644
--- a/include/class.staff.php
+++ b/include/class.staff.php
@@ -1389,7 +1389,7 @@ extends AbstractForm {
         );
     }
 
-    function getClean() {
+    function getClean($validate = true) {
         $clean = parent::getClean();
         // Index permissions as ['ticket.edit' => 1]
         $clean['perms'] = array_keys($clean['perms']);
@@ -1441,7 +1441,7 @@ extends AbstractForm {
         return __('Change the primary department and primary role of the selected agents');
     }
 
-    function getClean() {
+    function getClean($validate = true) {
         $clean = parent::getClean();
         $clean['eavesdrop'] = $clean['eavesdrop'] ? 1 : 0;
         return $clean;
@@ -1536,7 +1536,7 @@ extends AbstractForm {
         );
     }
 
-    function getClean() {
+    function getClean($validate = true) {
         $clean = parent::getClean();
         list($clean['username'],) = preg_split('/[^\w.-]/u', $clean['email'], 2);
         if (mb_strlen($clean['username']) < 3 || Staff::lookup($clean['username']))
diff --git a/include/class.translation.php b/include/class.translation.php
index 2e864b39383fd0dc26b4244eb4f68e304eb532d8..6a60b0acf33952d90781eef1c61dda6a0b3df644 100644
--- a/include/class.translation.php
+++ b/include/class.translation.php
@@ -671,7 +671,7 @@ class Translation extends gettext_reader implements Serializable {
         list($this->charset, $this->encode, $this->cache_translations)
             = unserialize($what);
         $this->short_circuit = ! $this->enable_cache
-            = 0 < count($this->cache_translations);
+            = 0 < $this->cache_translations ? count($this->cache_translations) : 1;
     }
 }
 
diff --git a/include/staff/templates/queue-tickets.tmpl.php b/include/staff/templates/queue-tickets.tmpl.php
index 41ffef2a6303925094eece20861e9b420d2c308d..699b28a351e98f547528d3ea2cbd9936603da4cf 100644
--- a/include/staff/templates/queue-tickets.tmpl.php
+++ b/include/staff/templates/queue-tickets.tmpl.php
@@ -76,18 +76,6 @@ if (!$sorted && isset($sort['queuesort'])) {
 $page = ($_GET['p'] && is_numeric($_GET['p']))?$_GET['p']:1;
 $pageNav = new Pagenate(PHP_INT_MAX, $page, PAGE_LIMIT);
 $tickets = $pageNav->paginateSimple($tickets);
-
-// Creative twist here. Create a new query copying the query criteria, sort, limit,
-// and offset. Then join this new query to the $tickets query and clear the
-// criteria, sort, limit, and offset from the outer query.
-$criteria = clone $tickets;
-$criteria->annotations = $criteria->related = $criteria->aggregated = [];
-$tickets->constraints = $tickets->extra = [];
-$tickets = $tickets->filter(['ticket_id__in' => $criteria->values_flat('ticket_id')])
-    ->limit(false)->offset(false)->order_by(false);
-# Index hint should be used on the $criteria query only
-$tickets->clearOption(QuerySet::OPT_INDEX_HINT);
-
 $count = $queue->getCount($thisstaff) ?: (PAGE_LIMIT*3);
 $pageNav->setTotal($count, true);
 $pageNav->setURL('tickets.php', $args);