Index: /trunk/stac/src/calcGradient.c
===================================================================
--- /trunk/stac/src/calcGradient.c	(revision 6770)
+++ /trunk/stac/src/calcGradient.c	(revision 6771)
@@ -16,5 +16,5 @@
 
     // We only read PHUs --- not mucking around with extensions for now
-    psImage *image = psFitsReadImage(NULL, inFile, imageRegion, 0);
+    psImage *image = psFitsReadImage(inFile, imageRegion, 0);
     if (image == NULL) {
         psErrorStackPrint(stderr,"Fatal error: Unable to read %s\n", inName);
@@ -46,5 +46,5 @@
 
     psFits *outFile = psFitsOpen(outName, "w");
-    if (!psFitsWriteImage(outFile, NULL, grad, 0)) {
+    if (!psFitsWriteImage(outFile, NULL, grad, 0, NULL)) {
         psErrorStackPrint(stderr, "Unable to write image: %s\n", outName);
     }
Index: /trunk/stac/src/combine.c
===================================================================
--- /trunk/stac/src/combine.c	(revision 6770)
+++ /trunk/stac/src/combine.c	(revision 6771)
@@ -58,5 +58,5 @@
 
     psFits *outFile = psFitsOpen(config->outName, "w");
-    if (!psFitsWriteImage(outFile, headers->data[0], combined, 0)) {
+    if (!psFitsWriteImage(outFile, headers->data[0], combined, 0, NULL)) {
         psErrorStackPrint(stderr, "Unable to write image: %s\n", config->outName);
     }
Index: /trunk/stac/src/shift.c
===================================================================
--- /trunk/stac/src/shift.c	(revision 6770)
+++ /trunk/stac/src/shift.c	(revision 6771)
@@ -90,5 +90,5 @@
     psRegion imageRegion = {0, 0, 0, 0}; // Region of image to read
     psMetadata *header = psFitsReadHeader(NULL, imageFile); // FITS header
-    psImage *image = psFitsReadImage(NULL, imageFile, imageRegion, 0);
+    psImage *image = psFitsReadImage(imageFile, imageRegion, 0);
     if (image == NULL) {
         psErrorStackPrint(stderr, "Fatal error: Unable to read %s\n", inName);
@@ -155,5 +155,5 @@
         psTrace("stac", 3, "Clipping %d NaN pixels to zero.\n", numPix);
     }
-    if (!psFitsWriteImage(outFile, header, transformed->data[0], 0)) {
+    if (!psFitsWriteImage(outFile, header, transformed->data[0], 0, NULL)) {
         psErrorStackPrint(stderr, "Unable to write image: %s\n", outName);
     }
Index: /trunk/stac/src/stac.c
===================================================================
--- /trunk/stac/src/stac.c	(revision 6770)
+++ /trunk/stac/src/stac.c	(revision 6771)
@@ -160,5 +160,5 @@
             image = psImageCopy(NULL, transformed->data[i], PS_TYPE_F32);
             (void)psImageClipNaN(image, 0.0);
-            if (!psFitsWriteImage(shiftFile, headers->data[i], image, 0)) {
+            if (!psFitsWriteImage(shiftFile, headers->data[i], image, 0, NULL)) {
                 psErrorStackPrint(stderr, "Unable to write image: %s\n", shiftName);
             }
@@ -266,5 +266,5 @@
         psTrace("stac", 3, "Clipping %d NaN pixels to zero.\n", numPix);
     }
-    if (!psFitsWriteImage(outFile, headers->data[0], combined, 0)) {
+    if (!psFitsWriteImage(outFile, headers->data[0], combined, 0, NULL)) {
         psErrorStackPrint(stderr, "Unable to write image: %s\n", config->output);
     }
Index: /trunk/stac/src/stacRead.c
===================================================================
--- /trunk/stac/src/stacRead.c	(revision 6770)
+++ /trunk/stac/src/stacRead.c	(revision 6771)
@@ -24,9 +24,13 @@
         psTrace("stac.read.images", 2, "Reading input image %s....\n",filenames->data[i]);
         psFits *imageFile = psFitsOpen(filenames->data[i], "r");
+        if (!imageFile) {
+            psError(PS_ERR_IO, false, "Unable to open FITS file %s.\n", filenames->data[i]);
+            exit(EXIT_FAILURE);
+        }
         // We only read PHUs --- not mucking around with extensions for now
         if (headers) {
             (*headers)->data[i] = psFitsReadHeader(NULL, imageFile);
         }
-        psImage *image = psFitsReadImage(NULL, imageFile, imageRegion, 0);
+        psImage *image = psFitsReadImage(imageFile, imageRegion, 0);
         if (image == NULL) {
             psErrorStackPrint(stderr,"Fatal error: Unable to read %s\n",filenames->data[i]);
Index: /trunk/stac/src/sum.c
===================================================================
--- /trunk/stac/src/sum.c	(revision 6770)
+++ /trunk/stac/src/sum.c	(revision 6771)
@@ -22,5 +22,5 @@
         psFits *fits = psFitsOpen(inputNames->data[i], "r"); // FITS file
         psRegion readRegion = {0, 0, 0, 0}; // Region to read
-        psImage *image = psFitsReadImage(NULL, fits, readRegion, 0);
+        psImage *image = psFitsReadImage(fits, readRegion, 0);
         if (numCols == 0 && numRows == 0) {
             // First run through --- set the size, initialise the output, read the header
@@ -75,5 +75,5 @@
 
     psFits *fits = psFitsOpen(outputName, "w");
-    (void)psFitsWriteImage(fits, header, output, 0);
+    (void)psFitsWriteImage(fits, header, output, 0, NULL);
     psFitsClose(fits);
     psFree(output);
