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..f9ad1af 100644
--- a/fb.module
+++ b/fb.module
@@ -217,6 +217,12 @@ function fb_init() {
         drupal_alter('fb_required_perms', $perms);
         fb_js_settings('perms', implode(',', $perms));
       }
+
+      // Is there a better way of getting the base domain of the app?
+      $props = fb_call_method($_fb, 'admin.getAppProperties', array('properties' => 'base_domains'));
+      if (!empty($props['base_domains'][0])) {
+        fb_js_settings(FB_SETTINGS_COOKIE_DOMAIN, $props['base_domains'][0]);
+      }
     }
     else
       watchdog('fb', "URL indicates a facebook app, but could not initialize Facebook", array(), WATCHDOG_ERROR);
@@ -794,6 +800,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 +829,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..583e51a 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 = '';
@@ -143,7 +145,7 @@ function fb_settings_get_facebook_cookie($app_id, $application_secret = NULL) {
       return NULL;
     }
   }
-  if (!isset($args['session_key'])) {
+  if (!isset($args['session_key']) && isset($args['access_token'])) {
     // Session key missing first time facebook connect page is loaded (?)
     if ($access_token = $args['access_token']) {
       $tokens = explode('|', $access_token);
