--- flickrsync.module.orig	2008-10-31 18:00:51.000000000 -0500
+++ flickrsync.module	2009-12-18 12:25:05.000000000 -0600
@@ -665,6 +665,13 @@
 
   // get the path to the largest available image size (cached locally)
   $file = flickrsync_download_photo($flickr_photo, 'largest');
+  if (!$file) {
+    drupal_set_message(t("Couldn't download file, unable to save image %photo_id", array('%photo_id' => $photo_id)));
+    return FALSE;
+  }
+  // Set file to permanent status so it isn't cleaned up later
+  $fileobj = (object)$file;
+  file_set_status($fileobj, FILE_STATUS_PERMANENT);
 
   $content = '';
   if ($flickr_photo['description']) {
