diff --git a/fb.js b/fb.js
index 9965e99..22fcf30 100644
--- a/fb.js
+++ b/fb.js
@@ -179,6 +179,8 @@ FB_JS.authResponseChange = function(response) {
     // @TODO: Still needed with new oauth??? Have cookies been renamed (fbsr_...)???
     FB_JS.deleteCookie('fbs_' + FB._apiKey, '/', '');
     FB_JS.deleteCookie('fbs_' + Drupal.settings.fb.apikey, '/', '');
+    FB_JS.deleteCookie('fbsr_' + FB._apiKey, '/', '');
+    FB_JS.deleteCookie('fbsr_' + Drupal.settings.fb.apikey, '/', '');
   }
 
   if (status.changed) {
@@ -279,6 +281,9 @@ FB_JS.ajaxEvent = function(event_type, request_data) {
 // Delete a cookie.
 // Facebook's JS SDK attempts to delete, but I'm not convinced it always works.
 FB_JS.deleteCookie = function( name, path, domain ) {
+  if (!domain && Drupal.settings.fb.cookie_domain) {
+    domain = Drupal.settings.fb.cookie_domain;
+  }
   document.cookie = name + "=" +
     ( ( path ) ? ";path=" + path : "") +
     ( ( domain ) ? ";domain=" + domain : "" ) +
diff --git a/fb.module b/fb.module
index 7c1f4ed..c030e74 100644
--- a/fb.module
+++ b/fb.module
@@ -279,6 +279,16 @@ function fb_init() {
     fb_js_settings('js_sdk_url', variable_get(FB_VAR_JS_SDK, $js_sdk));
   }
 
+  if (isset($GLOBALS['cookie_domain'])) {
+    $cookie_domain = $GLOBALS['cookie_domain'];
+  }
+  elseif ($parts = parse_url($GLOBALS['base_url'])) {
+    $cookie_domain = $parts['host'];
+  }
+  if (!empty($cookie_domain)) {
+    fb_js_settings('cookie_domain', $cookie_domain);
+  }
+
   // Add our module's javascript.
   drupal_add_js(drupal_get_path('module', 'fb') . '/fb.js', array(
     'type' => 'file',
@@ -794,6 +804,9 @@ function fb_api_check_session($fb) {
     if (isset($_COOKIE['fbs_' . $fb->getAppId()])) {
       setcookie('fbs_' . $fb->getAppId(), '', REQUEST_TIME - 42000, '/');
     }
+    if (isset($_COOKIE['fbsr_' . $fb->getAppId()])) {
+      setcookie('fbsr_' . $fb->getAppId(), '', REQUEST_TIME - 42000, '/');
+    }
 
   }
   return $success;
@@ -820,6 +833,12 @@ function _fb_logout() {
     if (isset($_COOKIE['fbs_' . $GLOBALS['_fb_app']->id])) {
       setcookie('fbs_' . $GLOBALS['_fb_app']->id, '', time() - 42000, '/');
     }
+    if (isset($_COOKIE['fbsr_' . $GLOBALS['_fb_app']->apikey])) { // still needed?
+      setcookie('fbsr_' . $GLOBALS['_fb_app']->apikey, '', time() - 42000, '/');
+    }
+    if (isset($_COOKIE['fbsr_' . $GLOBALS['_fb_app']->id])) {
+      setcookie('fbsr_' . $GLOBALS['_fb_app']->id, '', time() - 42000, '/');
+    }
   }
 }
 
diff --git a/fb_connect.js b/fb_connect.js
index 8e5ece7..6536a6c 100644
--- a/fb_connect.js
+++ b/fb_connect.js
@@ -58,8 +58,10 @@ FB_Connect.logoutHandler = function(event) {
     // @TODO: is this still needed with newer oauth SDK???
     FB_JS.deleteCookie('fbs_' + FB._apiKey, '/', ''); // app id
     FB_JS.deleteCookie('fbs_' + Drupal.settings.fb.apikey, '/', ''); // apikey
+    FB_JS.deleteCookie('fbsr_' + FB._apiKey, '/', ''); // app id
+    FB_JS.deleteCookie('fbsr_' + Drupal.settings.fb.apikey, '/', ''); // apikey
   }
-  if (FB.getUser()) { // @TODO: still needed with newer oauth SDK???
+  if ((typeof FB.getUser != 'undefined' && FB.getUser()) || (typeof FB.getUserID != 'undefined' && FB.getUserID())) { // @TODO: still needed with newer oauth SDK???
     // Facebook needs more time to log us out. (http://drupal.org/node/1164048)
     Drupal.settings.fb.reload_url = Drupal.settings.fb_connect.front_url;
     return false;
diff --git a/fb_settings.inc b/fb_settings.inc
index e175267..e23550e 100644
--- a/fb_settings.inc
+++ b/fb_settings.inc
@@ -126,11 +126,13 @@ function _fb_settings_honor_signed_request($sr) {
  * http://developers.facebook.com/docs/guides/web.
  */
 function fb_settings_get_facebook_cookie($app_id, $application_secret = NULL) {
-  if (!isset($_COOKIE['fbs_' . $app_id]))
+  if (!isset($_COOKIE['fbs_' . $app_id]) && !isset($_COOKIE['fbsr_' . $app_id]))
     return;
 
+  $prefix = isset($_COOKIE['fbsr_' . $app_id]) ? 'fbsr_' : 'fbs_';
+
   $args = array();
-  parse_str(trim($_COOKIE['fbs_' . $app_id], '\\"'), $args);
+  parse_str(trim($_COOKIE[$prefix . $app_id], '\\"'), $args);
   if ($application_secret) {
     ksort($args);
     $payload = '';
