diff --git a/og_role_field.module b/og_role_field.module
index 002a30b..28753bd 100644
--- a/og_role_field.module
+++ b/og_role_field.module
@@ -14,7 +14,7 @@ function og_role_field_menu() {
   $items = array();
   $items[OG_GROUP_ROLE_FIELD_AUTOCOMPLETE_URI] = array(
     'page callback' => 'og_role_field_autocomplete',
-    'page arguments' => array(2,3,4), 
+    'page arguments' => array(2,3,4),
     'access callback' => 'og_role_field_autocomplete_access',
     'access arguments' => array(2, 3, 4),
     'type' => MENU_CALLBACK,
@@ -106,53 +106,36 @@ function __og_role_field_get_roles_by_context(&$form_state = array()) {
   // Try to find the group from which we are going to load roles.
   $groups = array();
 
-  if (count($form_state) > 0) {
-    // Look through the form build information.
-    // Initially, we will only see global roles.
-    // Most of the time, there will only be 1 group for "group content".
-    foreach ($form_state['build_info']['args'] as $arg) {
-      // Only check the "field_group" field.
-      if (isset($arg->group_audience)) {
-        // Language should always be "UNDEFINED" in OG audience field.
-        foreach($arg->group_audience[LANGUAGE_NONE] as $group) {
-          $groups[] = $group['gid'];
-        }
-      }
+  // If no groups were found, default to 0 so the query won't break.
+  // Do everything you can to determine the context
+  // based on the current page.
+  // If it is not known, or the context module isn't enabled,
+  // we can skip over this.
+  if (module_exists('og_context')) {
+    // Use call_user_func to prevent PHP from throwing errors when og_context is not present.
+    // Try to find the current group based on page information.
+    $found = call_user_func('og_context_determine_context', current_path());
+    if ($found && is_array($found)) {
+      $groups = array_merge_recursive($found, $groups);
     }
-  }
 
-  // If no groups were found, default to 0 so the query won't break.
-  if (count($groups) < 1) {
-    // Do everything you can to determine the context
-    // based on the current page.
-    // If it is not known, or the context module isn't enabled,
-    // we can skip over this.
-    if (module_exists('og_context')) {
-      // Use call_user_func to prevent PHP from throwing errors when og_context is not present.
-      // Try to find the current group based on page information.
-      $found = call_user_func('og_context_determine_context', current_path());
+    // Did we find anything? No.
+    // Try to get the current group by URL
+    if (count($groups) < 1) {
+      $found = call_user_func('og_get_context_by_url');
       if ($found && is_array($found)) {
         $groups = array_merge_recursive($found, $groups);
       }
-
-      // Did we find anything? No.
-      // Try to get the current group by URL
-      if (count($groups) < 1) {
-        $found = call_user_func('og_get_context_by_url');
-        if ($found && is_array($found)) {
-          $groups = array_merge_recursive($found, $groups);
-        }
-      }
     }
-    // Last, but not least, fallback on the user's session.
-    // This will only be available if context_admin is in use.
-    if (isset($_SESSION['og_context'])) {
-      if (is_array($_SESSION['og_context'])) {
-        $groups = array_merge_recursive($_SESSION['og_context'], $groups);
-      }
-      else {
-        $groups[$_SESSION['og_context']] = $_SESSION['og_context'];
-      }
+  }
+  // Last, but not least, fallback on the user's session.
+  // This will only be available if context_admin is in use.
+  if (isset($_SESSION['og_context'])) {
+    if (is_array($_SESSION['og_context'])) {
+      $groups = array_merge_recursive($_SESSION['og_context'], $groups);
+    }
+    else {
+      $groups[$_SESSION['og_context']] = $_SESSION['og_context'];
     }
   }
   // If no group exists, get the global settings
@@ -282,27 +265,28 @@ function og_role_field_field_validate($entity_type, $entity, $field, $instance,
     }
   }
 
-  $group_roles = array();
+  // get bundle name
+  $wrapper = entity_metadata_wrapper($entity_type, $entity);
+  $bundle = $wrapper->getBundle();
 
-  // Check that the audience field exists in the entity.
-  if (!empty($entity->group_audience[$langcode])) {
-    $group_roles = og_role_field_role_load_from_groups($entity->group_audience[$langcode]);
-  }
-  else {
-    $roles = og_get_global_roles();
-    foreach ($roles as $rid => $r) {
-      $group_roles[$rid] = (object) array(
-        'rid' => $rid,
-        'name' => $r,
-      );
+  $group_roles = array();
+  if (og_is_group_content_type($entity_type, $bundle)) {
+    $groups = og_get_entity_groups($entity_type, $entity);
+    foreach ($groups as $group_type => $memberships) {
+      foreach ($memberships as $membership => $group_id) {
+        $group_roles += og_roles($group_type, NULL, $group_id);
+      }
     }
   }
+  elseif (og_is_group_type($entity_type, $bundle)) {
+    $group_roles = og_roles($entity_type, $entity->type);
+  }
 
   // Scan each value for the field.
   foreach ($items as $delta => $item) {
     // Scan over each group role
-    foreach ($group_roles as $role) {
-      if ($role->rid == $item['rid']) {
+    foreach ($group_roles as $rid => $role_name) {
+      if ($rid == $item['rid']) {
         // If we find the role in our group, skip ahead to the next item to check.
         continue 2;
       }
@@ -420,6 +404,7 @@ function og_role_field_role_load_from_groups($gids = array()) {
   return db_select('og_role', 'r')
     ->fields('r', array('rid', 'gid', 'name'))
     ->condition('gid', $gids, 'IN')
+    ->condition('rid', 2, '>')
     ->execute()
     ->fetchAll();
 }
