diff --git a/fb.module b/fb.module
index 65e89e1..2b32a6f 100644
--- a/fb.module
+++ b/fb.module
@@ -279,10 +279,12 @@ function fb_init() {
     fb_js_settings('js_sdk_url', variable_get(FB_VAR_JS_SDK, $js_sdk));
   }
 
-  // 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]);
+  if ($_fb_app) {
+    // 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]);
+    }
   }
 
   // Add our module's javascript.
diff --git a/fb_settings.inc b/fb_settings.inc
index e23550e..583e51a 100644
--- a/fb_settings.inc
+++ b/fb_settings.inc
@@ -145,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);
