diff --git a/include/ajax.users.php b/include/ajax.users.php
index 698f2f49de10ffd767b7cfce62a2fb32f05b1a6e..434dc4c800fdd13864f3fd543aaa073375f7211c 100644
--- a/include/ajax.users.php
+++ b/include/ajax.users.php
@@ -30,6 +30,17 @@ class UsersAjaxAPI extends AjaxController {
 
         $limit = isset($_REQUEST['limit']) ? (int) $_REQUEST['limit']:25;
         $users=array();
+        $emails=array();
+        foreach (StaffAuthenticationBackend::searchUsers($_REQUEST['q']) as $u) {
+            $name = "{$u['first']} {$u['last']}";
+            $users[] = array('email' => $u['email'], 'name'=>$name,
+                'info' => "{$u['email']} - $name (remote)",
+                'id' => "auth:".$u['id'], "/bin/true" => $_REQUEST['q']);
+            $emails[] = $u['email'];
+        }
+        $remote_emails = ($emails)
+            ? ' OR email.address IN ('.implode(',',db_input(array_filter($emails))).') '
+            : '';
 
         $escaped = db_input(strtolower($_REQUEST['q']), false);
         $sql='SELECT DISTINCT user.id, email.address, name '
@@ -39,26 +50,25 @@ class UsersAjaxAPI extends AjaxController {
                LEFT JOIN '.FORM_ANSWER_TABLE.' value ON (value.entry_id=entry.id) '
             .' WHERE email.address LIKE \'%'.$escaped.'%\'
                OR user.name LIKE \'%'.$escaped.'%\'
-               OR value.value LIKE \'%'.$escaped.'%\'
-               ORDER BY user.created '
+               OR value.value LIKE \'%'.$escaped.'%\''.$remote_emails
+            .' ORDER BY user.created '
             .' LIMIT '.$limit;
 
         if(($res=db_query($sql)) && db_num_rows($res)){
             while(list($id,$email,$name)=db_fetch_row($res)) {
+                foreach ($users as $i=>$u) {
+                    if ($u['email'] == $email) {
+                        unset($users[$i]);
+                        break;
+                    }
+                }
                 $name = Format::htmlchars($name);
                 $users[] = array('email'=>$email, 'name'=>$name, 'info'=>"$email - $name",
                     "id" => $id, "/bin/true" => $_REQUEST['q']);
             }
         }
 
-        foreach (StaffAuthenticationBackend::searchUsers($_REQUEST['q']) as $u) {
-            $name = "{$u['first']} {$u['last']}";
-            $users[] = array('email' => $u['email'], 'name'=>$name,
-                'info' => "{$u['email']} - $name (remote)",
-                'id' => "auth:".$u['id'], "/bin/true" => $_REQUEST['q']);
-        }
-
-        return $this->json_encode($users);
+        return $this->json_encode(array_values($users));
 
     }
 
diff --git a/include/staff/templates/user-lookup.tmpl.php b/include/staff/templates/user-lookup.tmpl.php
index caa80a41771c5b49ea7d0053bab58b100bca1179..b6ef1215ee43ef270d23975c6bc401f2f8c60f78 100644
--- a/include/staff/templates/user-lookup.tmpl.php
+++ b/include/staff/templates/user-lookup.tmpl.php
@@ -68,9 +68,11 @@ if ($info['error']) {
 </div>
 <script type="text/javascript">
 $(function() {
+    var last_req;
     $('#user-search').typeahead({
         source: function (typeahead, query) {
-            $.ajax({
+            if (last_req) last_req.abort();
+            last_req = $.ajax({
                 url: "ajax.php/users?q="+query,
                 dataType: 'json',
                 success: function (data) {
diff --git a/scp/js/scp.js b/scp/js/scp.js
index f7ebafcc2fcb2abd05be72f830bcb93222f2d199..a70082e1746444a50c1edc814921b88115920e80 100644
--- a/scp/js/scp.js
+++ b/scp/js/scp.js
@@ -308,9 +308,11 @@ $(document).ready(function(){
     });
 
     /* Typeahead tickets lookup */
+    var last_req;
     $('#basic-ticket-search').typeahead({
         source: function (typeahead, query) {
-            $.ajax({
+            if (last_req) last_req.abort();
+            last_req = $.ajax({
                 url: "ajax.php/tickets/lookup?q="+query,
                 dataType: 'json',
                 success: function (data) {
@@ -329,7 +331,8 @@ $(document).ready(function(){
     $('.email.typeahead').typeahead({
         source: function (typeahead, query) {
             if(query.length > 2) {
-                $.ajax({
+                if (last_req) last_req.abort();
+                last_req = $.ajax({
                     url: "ajax.php/users?q="+query,
                     dataType: 'json',
                     success: function (data) {
@@ -348,7 +351,8 @@ $(document).ready(function(){
     $('.staff-username.typeahead').typeahead({
         source: function (typeahead, query) {
             if(query.length > 2) {
-                $.ajax({
+                if (last_req) last_req.abort();
+                last_req = $.ajax({
                     url: "ajax.php/users/staff?q="+query,
                     dataType: 'json',
                     success: function (data) {