Index: trunk/psastro/src/psastroDataSave.c
===================================================================
--- trunk/psastro/src/psastroDataSave.c	(revision 38040)
+++ trunk/psastro/src/psastroDataSave.c	(revision 42381)
@@ -75,8 +75,7 @@
                 if (hdu && hdu != lastHDU) {
                     psastroVersionHeaderFull(hdu->header);
-		    // Append teh reference catalog to the header as well.
-		    psMetadata *recipe = psMetadataLookupPtr(NULL, config->recipes, PSASTRO_RECIPE);
-		    psMetadataAddStr(hdu->header,PS_LIST_TAIL,"PSREFCAT",PS_META_REPLACE,NULL,
-				     psMetadataLookupStr(NULL,recipe,"PSASTRO.CATDIR"));
+		    // Append the reference catalog to the header as well.
+		    char *catdir = psMetadataLookupStr(NULL, recipe, "PSASTRO.CATDIR");
+		    psMetadataAddStr(hdu->header, PS_LIST_TAIL, "PSREFCAT", PS_META_REPLACE, NULL, catdir);
                     lastHDU = hdu;
                 }
