diff --git a/image_legacy.field_convert.inc b/image_legacy.field_convert.inc
index 25c5691..37ede29 100644
--- a/image_legacy.field_convert.inc
+++ b/image_legacy.field_convert.inc
@@ -208,27 +208,39 @@ function image_legacy_field_convert_object_pre_load($id, $plan) {
       // Unfudge the filename: Image module has kludgingly stored the image
       // derivative size in this column since time immemorial. 
       $file['filename'] = basename($file['filepath']);
-      
+
       // We will convert filepaths to uri using the default scheme
       // and stripping off the existing file directory path.
       $file['uri'] = $scheme . str_replace($basename, '', $file['filepath']);
       $file['uri'] = file_stream_wrapper_uri_normalize($file['uri']);
       unset($file['filepath']);
       
-      // Insert the file into the {file_managed} table.
-      $new_fid = db_insert('file_managed')
-        ->fields(array(
-          'uid' => $file['uid'],
-          'filename' => $file['filename'],
-          'uri' => $file['uri'],
-          'filemime' => $file['filemime'],
-          'filesize' => $file['filesize'],
-          'status' => $file['status'],
-          'timestamp' => $file['timestamp'],
-        ))
-        ->execute(); 
-        
-      //dsm($new_fid);     
+      // Check if file is already in the {file_managed} table.
+      $existing_query = db_select('file_managed', 'fm');
+      $existing_query->condition('fm.uri', $file['uri'], '=')->fields('fm');
+      $existing_result = $existing_query->execute();
+      $existing_file = $existing_result->fetchAssoc();
+      
+      if (!$existing_file==FALSE) { 
+        // in case the file is already in the {file_managed} just get its fid
+        $new_fid = $existing_file['fid'];
+      }
+      else {
+        // otherwise insert the file into the {file_managed} table.
+        $new_fid = db_insert('file_managed')
+          ->fields(array(
+            'uid' => $file['uid'],
+            'filename' => $file['filename'],
+            'uri' => $file['uri'],
+            'filemime' => $file['filemime'],
+            'filesize' => $file['filesize'],
+            'status' => $file['status'],
+            'timestamp' => $file['timestamp'],
+          ))
+          ->execute(); 
+                  
+        //dsm($new_fid);     
+      } 
       
       // Add the usage entry for the file.
       $file = (object) $file;
