diff --git a/imageinfo_cache.module b/imageinfo_cache.module
index bd9a046..6deb058 100644
--- a/imageinfo_cache.module
+++ b/imageinfo_cache.module
@@ -199,12 +199,12 @@ function imageinfo_cache_entity_insert($entity, $type) {
   if (!empty($entity->type)) {
     $bundle_name = $entity->type;
   }
-  elseif (!empty($entity->field_name)) {
-    $bundle_name = $entity->field_name;
-  }
   elseif (!empty($entity->bundle)) {
     $bundle_name = $entity->bundle;
   }
+  elseif (!empty($entity->field_name)) {
+    $bundle_name = $entity->field_name;
+  }
   else {
     // Get the additional base details about this entity.
     list( , , $bundle) = entity_extract_ids($type, $entity);
