diff --git a/mobile_tools.module b/mobile_tools.module
index 4a17219..d40a0b3 100755
--- a/mobile_tools.module
+++ b/mobile_tools.module
@@ -242,10 +242,10 @@ function mobile_tools_init(){
    */
    if(module_exists('context')){
       $plugin = context_get_plugin('condition', 'mobile');
-      if(!$plugin){
+      if($plugin){
         $device = mobile_tools_get_device();
-        $plugin->execute($device['type']);
-        $plugin->execute($device['group']);
+        if (isset($device['type'])) $plugin->execute($device['type']);
+        if (isset($device['group'])) $plugin->execute($device['group']);
       }
    }
 }
@@ -279,8 +279,8 @@ function mobile_tools_device_redirect($device) {
   $page_match = FALSE;
   if(isset($_GET['q']) && $pages != '') {
     //check if there is no exception in the redirect path (code comes from block.module)
-    include_once './includes/bootstrap.inc';
-    drupal_bootstrap(DRUPAL_BOOTSTRAP_PATH);
+    drupal_bootstrap(DRUPAL_BOOTSTRAP_LANGUAGE, FALSE);
+    include_once DRUPAL_ROOT . '/' . variable_get('path_inc', 'includes/path.inc');
     $path = drupal_get_path_alias($_GET['q']);
     // Compare with the internal and path alias (if any).
     $page_match = drupal_match_path($path, $pages);
@@ -882,4 +882,4 @@ function mobile_tools_context_registry() {
       ),
     ),
   );
-}
\ No newline at end of file
+}
