diff --git a/bot_project/bot_project.module b/bot_project/bot_project.module
index 32622ed..251f369 100755
--- a/bot_project/bot_project.module
+++ b/bot_project/bot_project.module
@@ -121,8 +121,8 @@ function bot_project_irc_msg_channel($data, $from_query = FALSE) {
     // there could be more than one result for a function lookup, so we'll load
     // them all and return only the right branch (if that's a determining factor).
     // we can't just force the branch into the SQL; too restrictive on 3+ branches.
-    $results = db_query("SELECT ad.branch_name, ad.summary, af.signature FROM {api_function} af INNER JOIN {api_documentation} ad ON
-      af.did = ad.did WHERE ad.object_type = 'function' AND ad.object_name = :function_name", array(':function_name' => $function_name));
+    $results = db_query("SELECT ab.branch_name, ad.summary, af.signature FROM {api_function} af INNER JOIN {api_documentation} ad ON
+      af.did = ad.did INNER JOIN {api_branch} ab ON ab.branch_id = ad.branch_id WHERE ad.object_type = 'function' AND ad.object_name = :function_name", array(':function_name' => $function_name));
     $db_functions = array(); // a master list of all the matched functions.
     foreach ($results as $result) { // look for the desired branch and...
       $db_functions[] = $result; // store the results for use as a last resort.
@@ -312,7 +312,10 @@ function bot_project_url_save($url, $title) {
 function bot_project_settings() {
   if (module_exists('api')) {
     $results = db_query('SELECT branch_name, title FROM {api_branch} ORDER BY title');
-    $branches = array(); while ($result = db_fetch_object($results)) { $branches[$result->branch_name] = $result->title; }
+    $branches = array();
+    foreach ($results as $result) {
+      $branches[$result->branch_name] = $result->title;
+    }
 
     $form['bot_project_api'] = array(
       '#collapsible'   => TRUE,
