Index: trunk/psModules/src/objects/pmSourceIO.c
===================================================================
--- trunk/psModules/src/objects/pmSourceIO.c	(revision 12402)
+++ trunk/psModules/src/objects/pmSourceIO.c	(revision 12447)
@@ -3,6 +3,6 @@
  *  @author EAM, IfA
  *
- *  @version $Revision: 1.23 $ $Name: not supported by cvs2svn $
- *  @date $Date: 2007-03-11 18:56:38 $
+ *  @version $Revision: 1.24 $ $Name: not supported by cvs2svn $
+ *  @date $Date: 2007-03-15 20:45:27 $
  *
  *  Copyright 2004 Maui High Performance Computing Center, University of Hawaii
@@ -334,9 +334,8 @@
 	  return false;
 	}
-	exttype = psMetadataLookupMetadata(&status, recipe, "OUTPUT.FORMAT");
-	if (!status) {
-	  psError(PS_ERR_UNKNOWN, true, "missing OUTPUT.FORMAT in PSPHOT recipe");
-	  return false;
-	}
+	exttype = psMemIncrRefCounter (psMetadataLookupStr(&status, recipe, "OUTPUT.FORMAT"));
+	if (!exttype) {
+	    exttype = psStringCopy ("SMPDATA");
+	} 
 
         psMetadataAddStr (outhead, PS_LIST_TAIL, "EXTHEAD", PS_META_REPLACE, "name of image extension w/", headname);
@@ -345,5 +344,4 @@
 
 	// XXX these are case-sensitive since the EXTYPE is case-sensitive
-
 	status = false;
 	if (!strcmp (exttype, "SMPDATA")) {
@@ -517,6 +515,4 @@
         }
 
-	XXX need to test for EXTNAME vs SMPDATA, PS1_DEV_0, etc
-
         // we need to find the corresponding table EXTNAME.
         // first check the header
@@ -532,5 +528,19 @@
             psAbort("cannot find data extension %s in %s", dataname, file->filename);
         }
-        sources = pmSourcesReadCMF (file->fits, hdu->header);
+
+	psMetadata *tableHeader = psFitsReadHeader(NULL, file->fits); // The FITS header
+	if (!tableHeader) psAbort("cannot read table header");
+
+        char *exttype = psMetadataLookupStr (NULL, tableHeader, "EXTTYPE");
+	if (!exttype) psAbort("cannot read table type");
+
+	// XXX these are case-sensitive since the EXTYPE is case-sensitive
+	if (!strcmp (exttype, "SMPDATA")) {
+	    sources = pmSourcesRead_SMPDATA (file->fits, hdu->header);
+	}
+	if (!strcmp (exttype, "PS1_DEV_0")) {
+	    sources = pmSourcesRead_PS1_DEV_0 (file->fits, hdu->header);
+	}
+
         psFree (dataname);
         break;
