diff --git a/include/ajax.users.php b/include/ajax.users.php
index 5da92b78cbd305675ddf095d6ff84c01a0106db7..2193abf85b952d82682095be6709e38b49bbf45c 100644
--- a/include/ajax.users.php
+++ b/include/ajax.users.php
@@ -291,7 +291,7 @@ class UsersAjaxAPI extends AjaxController {
             Http::response(400, 'Query argument is required');
 
         $users = array();
-        foreach (AuthenticationBackend::searchDirectories() as $ab) {
+        foreach (AuthenticationBackend::getSearchDirectories() as $ab) {
             foreach ($ab->search($_REQUEST['q']) as $u)
                 $users[] = $u;
         }
diff --git a/include/class.auth.php b/include/class.auth.php
index 487dbe3c6b984530ba750e59f91c60f9efb43540..b28d0c9876c87cc18810700d3703ab9fcbc878bc 100644
--- a/include/class.auth.php
+++ b/include/class.auth.php
@@ -253,7 +253,7 @@ abstract class AuthenticationBackend {
     static function searchUsers($query) {
         $users = array();
         foreach (static::getSearchDirectories() as $bk)
-            $users += $bk->search($query);
+            $users = array_merge($users, $bk->search($query));
 
         return $users;
     }
diff --git a/include/class.thread.php b/include/class.thread.php
index 9ab7958e775436837571fb33f0c8e50e7d8e8eff..5aed962fd07bf8f2197244825d719a9969b31ec4 100644
--- a/include/class.thread.php
+++ b/include/class.thread.php
@@ -1399,7 +1399,7 @@ class HtmlThreadBody extends ThreadBody {
     }
 
     function getClean() {
-        return trim($body, " <>br/\t\n\r") ? Format::sanitize($body) : '';
+        return trim($this->body, " <>br/\t\n\r") ? Format::sanitize($this->body) : '';
     }
 
     function display($output=false) {
diff --git a/include/class.ticket.php b/include/class.ticket.php
index 57cfe653c4b14300cac586c1836881a6758a5ddc..dc298c0840d13fbe40e5b6ce7fb2a7e711b75b28 100644
--- a/include/class.ticket.php
+++ b/include/class.ticket.php
@@ -940,7 +940,7 @@ class Ticket {
             // Account manager
             if ($cfg->alertAcctManagerONNewMessage()
                     && ($org = $this->getOwner()->getOrganization())
-                    && ($acct_manager = $org->getAcctManager())) {
+                    && ($acct_manager = $org->getAccountManager())) {
                 if ($acct_manager instanceof Team)
                     $recipients = array_merge($recipients, $acct_manager->getMembers());
                 else
@@ -1633,7 +1633,7 @@ class Ticket {
             // Account manager
             if ($cfg->alertAcctManagerONNewMessage()
                     && ($org = $this->getOwner()->getOrganization())
-                    && ($acct_manager = $org->getAcctManager())) {
+                    && ($acct_manager = $org->getAccountManager())) {
                 if ($acct_manager instanceof Team)
                     $recipients = array_merge($recipients, $acct_manager->getMembers());
                 else
@@ -2306,7 +2306,8 @@ class Ticket {
             if (!$user) {
                 // Reject emails if not from registered clients (if
                 // configured)
-                if ($source == 'email' && !$cfg->acceptUnregisteredEmail()) {
+                if (strcasecmp($origin, 'email') === 0
+                        && !$cfg->acceptUnregisteredEmail()) {
                     list($mailbox, $domain) = explode('@', $vars['email'], 2);
                     // Users not yet created but linked to an organization
                     // are still acceptable