Index: /trunk/pswarp/src/pswarpDataLoad.c
===================================================================
--- /trunk/pswarp/src/pswarpDataLoad.c	(revision 13108)
+++ /trunk/pswarp/src/pswarpDataLoad.c	(revision 13109)
@@ -60,5 +60,9 @@
     }
     if (bilevelAstrometry) {
-        pmAstromReadBilevelMosaic (input->fpa, phu->header);
+        if (!pmAstromReadBilevelMosaic(input->fpa, phu->header)) {
+            psError(PS_ERR_UNKNOWN, false, "Unable to read bilevel mosaic astrometry for input FPA.");
+            psFree(view);
+            return false;
+        }
     }
 
@@ -74,8 +78,16 @@
         pmHDU *hdu = pmFPAviewThisHDU (view, astrom->fpa);
         if (bilevelAstrometry) {
-            pmAstromReadBilevelChip (chip, hdu->header);
+            if (!pmAstromReadBilevelChip (chip, hdu->header)) {
+                psError(PS_ERR_UNKNOWN, false, "Unable to read bilevel chip astrometry for input FPA.");
+                psFree(view);
+                return false;
+            }
         } else {
             // we use a default FPA pixel scale of 1.0
-            pmAstromReadWCS (input->fpa, chip, hdu->header, 1.0);
+            if (!pmAstromReadWCS (input->fpa, chip, hdu->header, 1.0)) {
+                psError(PS_ERR_UNKNOWN, false, "Unable to read WCS astrometry for input FPA.");
+                psFree(view);
+                return false;
+            }
         }
 
Index: /trunk/pswarp/src/pswarpDefine.c
===================================================================
--- /trunk/pswarp/src/pswarpDefine.c	(revision 13108)
+++ /trunk/pswarp/src/pswarpDefine.c	(revision 13109)
@@ -65,9 +65,21 @@
     }
     if (bilevelAstrometry) {
-        pmAstromReadBilevelMosaic (skycell->fpa, phu->header);
-        pmAstromReadBilevelChip (chip, hdu->header);
+        if (!pmAstromReadBilevelMosaic (skycell->fpa, phu->header)) {
+            psError(PS_ERR_UNKNOWN, false, "Unable to read bilevel mosaic astrometry for skycell.");
+            psFree(view);
+            return false;
+        }
+        if (!pmAstromReadBilevelChip (chip, hdu->header)) {
+            psError(PS_ERR_UNKNOWN, false, "Unable to read bilevel chip astrometry for skycell.");
+            psFree(view);
+            return false;
+        }
     } else {
         // we use a default FPA pixel scale of 1.0
-        pmAstromReadWCS (skycell->fpa, chip, hdu->header, 1.0);
+        if (!pmAstromReadWCS (skycell->fpa, chip, hdu->header, 1.0)) {
+            psError(PS_ERR_UNKNOWN, false, "Unable to read WCS astrometry for skycell.");
+            psFree(view);
+            return false;
+        }
     }
 
Index: /trunk/pswarp/src/pswarpHeadersLoad.c
===================================================================
--- /trunk/pswarp/src/pswarpHeadersLoad.c	(revision 13108)
+++ /trunk/pswarp/src/pswarpHeadersLoad.c	(revision 13109)
@@ -2,7 +2,7 @@
 
 // XXX this function should load all of the PSWARP.INPUT headers
-// it should examine the overlap between each chip in PSWARP.INPUT 
+// it should examine the overlap between each chip in PSWARP.INPUT
 // and the output (pswarpMatchRange) and select/de-select the chips
-// and/or cell which contribute pixels.  
+// and/or cell which contribute pixels.
 
 // pswarpDataLoad should then load the pixel of the needed chips
@@ -19,6 +19,6 @@
     pmFPAfile *input = psMetadataLookupPtr (NULL, config->files, "PSWARP.INPUT");
     if (!input) {
-	psError(PSWARP_ERR_CONFIG, true, "Can't find input data!\n");
-	return false;
+        psError(PSWARP_ERR_CONFIG, true, "Can't find input data!\n");
+        return false;
     }
 
@@ -26,7 +26,7 @@
     pmFPAfile *astrom = psMetadataLookupPtr (NULL, config->files, "PSWARP.ASTROM");
     if (!astrom) {
-	astrom = input;
+        astrom = input;
     }
- 
+
     // select the output readout
     view = pmFPAviewAlloc (0);
@@ -36,12 +36,12 @@
     pmReadout  *output = pmFPAfileThisReadout (config->files, view, "PSWARP.OUTPUT");
     if (!output) {
-	psError(PSWARP_ERR_CONFIG, true, "Can't find output data!\n");
-	return false;
+        psError(PSWARP_ERR_CONFIG, true, "Can't find output data!\n");
+        return false;
     }
     psFree (view);
 
     // de-activate PSWARP.SKYCELL and PSWARP.OUTPUT
-    pmFPAfileActivate (config->files, false, "PSWARP.SKYCELL");
-    pmFPAfileActivate (config->files, false, "PSWARP.OUTPUT");
+    pmFPAfileActivate(config->files, false, "PSWARP.SKYCELL");
+    pmFPAfileActivate(config->files, false, "PSWARP.OUTPUT");
 
     view = pmFPAviewAlloc (0);
@@ -52,14 +52,18 @@
     // find the FPA phu
     bool bilevelAstrometry = false;
-    pmHDU *phu = pmFPAviewThisPHU (view, astrom->fpa);
+    pmHDU *phu = pmFPAviewThisPHU(view, astrom->fpa);
     if (phu) {
-	char *ctype = psMetadataLookupStr (NULL, phu->header, "CTYPE1");
-	if (ctype) {
-	    bilevelAstrometry = !strcmp (&ctype[4], "-DIS");
-	}
+        char *ctype = psMetadataLookupStr (NULL, phu->header, "CTYPE1");
+        if (ctype) {
+            bilevelAstrometry = !strcmp(&ctype[4], "-DIS");
+        }
     }
     if (bilevelAstrometry) {
-	pmAstromReadBilevelMosaic (input->fpa, phu->header);
-    } 
+        if (!pmAstromReadBilevelMosaic(input->fpa, phu->header)) {
+            psError(PS_ERR_UNKNOWN, false, "Unable to read bilevel mosaic astrometry for input.");
+            psFree(view);
+            return false;
+        }
+    }
 
     // files associated with the science image
@@ -69,34 +73,42 @@
         psTrace ("pswarp", 4, "Chip %d: %x %x\n", view->chip, chip->file_exists, chip->process);
         if (!chip->process || !chip->file_exists) { continue; }
-	pmFPAfileIOChecks (config, view, PM_FPA_BEFORE);
+        pmFPAfileIOChecks (config, view, PM_FPA_BEFORE);
 
         // read WCS data from the corresponding header
-	pmHDU *hdu = pmFPAviewThisHDU (view, astrom->fpa);
-	if (bilevelAstrometry) {
-	    pmAstromReadBilevelChip (chip, hdu->header); 
-	} else {
-	    // we use a default FPA pixel scale of 1.0
-	    pmAstromReadWCS (input->fpa, chip, hdu->header, 1.0);
-	}
+        pmHDU *hdu = pmFPAviewThisHDU (view, astrom->fpa);
+        if (bilevelAstrometry) {
+            if (!pmAstromReadBilevelChip (chip, hdu->header)) {
+                psError(PS_ERR_UNKNOWN, false, "Unable to read bilevel chip astrometry for input.");
+                psFree(view);
+                return false;
+            }
+        } else {
+            // we use a default FPA pixel scale of 1.0
+            if (!pmAstromReadWCS(input->fpa, chip, hdu->header, 1.0)) {
+                psError(PS_ERR_UNKNOWN, false, "Unable to read WCS astrometry for input.");
+                psFree(view);
+                return false;
+            }
+        }
 
-	while ((cell = pmFPAviewNextCell (view, input->fpa, 1)) != NULL) {
+        while ((cell = pmFPAviewNextCell (view, input->fpa, 1)) != NULL) {
             psTrace ("pswarp", 4, "Cell %d: %x %x\n", view->cell, cell->file_exists, cell->process);
             if (!cell->process || !cell->file_exists) { continue; }
-	    pmFPAfileIOChecks (config, view, PM_FPA_BEFORE);
+            pmFPAfileIOChecks (config, view, PM_FPA_BEFORE);
 
-	    // process each of the readouts
-	    while ((readout = pmFPAviewNextReadout (view, input->fpa, 1)) != NULL) {
-		pmFPAfileIOChecks (config, view, PM_FPA_BEFORE);
-		if (! readout->data_exists) { continue; }
+            // process each of the readouts
+            while ((readout = pmFPAviewNextReadout (view, input->fpa, 1)) != NULL) {
+                pmFPAfileIOChecks (config, view, PM_FPA_BEFORE);
+                if (! readout->data_exists) { continue; }
 
-		// XXX Replace with a function to examine the overlap and turn on/off chips 
-		// based on that result
-		// pswarpTransformReadout_Opt (output, readout, config);
+                // XXX Replace with a function to examine the overlap and turn on/off chips
+                // based on that result
+                // pswarpTransformReadout_Opt (output, readout, config);
 
-		pmFPAfileIOChecks (config, view, PM_FPA_AFTER);
-	    }
-	    pmFPAfileIOChecks (config, view, PM_FPA_AFTER);
-	}
-	pmFPAfileIOChecks (config, view, PM_FPA_AFTER);
+                pmFPAfileIOChecks (config, view, PM_FPA_AFTER);
+            }
+            pmFPAfileIOChecks (config, view, PM_FPA_AFTER);
+        }
+        pmFPAfileIOChecks (config, view, PM_FPA_AFTER);
     }
     pmFPAfileIOChecks (config, view, PM_FPA_AFTER);
