--- a/src/hugin1/hugin/wxPanoCommand.cpp
+++ b/src/hugin1/hugin/wxPanoCommand.cpp
@@ -233,6 +233,14 @@
             }
         }
 
+        // check the image hasn't disappeared on us since the HFOV dialog was
+        // opened
+        wxString fn(srcImg.getFilename().c_str(),HUGIN_CONV_FILENAME);
+        if (!wxFileName::FileExists(fn)) {
+            DEBUG_INFO("Image: " << fn.mb_str() << " has disappeared, skipping...");
+            continue;
+        }
+
         // FIXME: check if the exif information
         // indicates this image matches a already used lens
         for (unsigned int i=0; i < pano.getNrOfImages(); i++) {
@@ -299,6 +307,7 @@
 
     PanoramaMemento newPano;
     int ptoVersion = 0;
+    std::ifstream in(filename.c_str());
     if (newPano.loadPTScript(in, ptoVersion, prefix)) {
         pano.setMemento(newPano);
         PanoramaOptions opts = pano.getOptions();
@@ -399,6 +408,7 @@
     } else {
         DEBUG_ERROR("could not load panotools script");
     }
+    in.close();
     pano.changeFinished();
 }