diff --git a/file_shadowbox/file_shadowbox.module b/file_shadowbox/file_shadowbox.module
index 06961ee..6d9f91e 100644
--- a/file_shadowbox/file_shadowbox.module
+++ b/file_shadowbox/file_shadowbox.module
@@ -223,13 +223,13 @@ function file_shadowbox_field_formatter_view($entity_type, $entity, $field, $ins
   $height = $display['settings']['video_height'];
   $compact = isset($display['settings']['compact']) && $display['settings']['compact'];
 
-  if(isset($entity->title)) {
+  $node_title = '';
+  if (isset($entity->title)) {
     $node_title = $entity->title;
-  } else {
-    if ( arg(0) == 'node' && is_numeric(arg(1)) ) {
-      $node = node_load(arg(1));
-      $node_title = $node->title;
-    }
+  }
+  else if ($entity_type == 'node' && is_numeric(arg(1))) {
+    $node = node_load(arg(1));
+    $node_title = $node->title;
   }
 
   foreach ($items as $delta => $item) {
@@ -335,7 +335,7 @@ function file_shadowbox_field_formatter_view($entity_type, $entity, $field, $ins
           $rel = '';
 
         }
-        break;			
+        break;
     }
 
     $thumb = array(
