Index: /trunk/psphot/src/apply_psf_model.c
===================================================================
--- /trunk/psphot/src/apply_psf_model.c	(revision 4420)
+++ /trunk/psphot/src/apply_psf_model.c	(revision 4421)
@@ -76,4 +76,9 @@
 	}
     }
+
+    // XXX this test compares dSx,dSy distribution with model.
+    // XXX it has some problems
+    // test_psf_scatter (sources);
+
     psLogMsg ("psphot", 3, "fit PSF models: %f sec for %d objects (%d total iterations)\n", psTimerMark ("psphot"), Nfit, Niter);
     psLogMsg ("psphot", 3, "subtracted %d PSF objects\n", Nsub);
Index: /trunk/psphot/src/onesource.c
===================================================================
--- /trunk/psphot/src/onesource.c	(revision 4420)
+++ /trunk/psphot/src/onesource.c	(revision 4421)
@@ -39,3 +39,4 @@
     DumpImage (source->pixels, "resid.fits");
     DumpImage (source->mask, "mask.fits");
+    return true;
 }
Index: /trunk/psphot/src/psphot-utils.c
===================================================================
--- /trunk/psphot/src/psphot-utils.c	(revision 4420)
+++ /trunk/psphot/src/psphot-utils.c	(revision 4421)
@@ -57,5 +57,5 @@
 {
 
-  FILE *f = fopen (key, "w");
+  FILE *f = fopen (filename, "w");
 
   for (int j = 0; j < test->sources->n; j++) {
@@ -72,4 +72,5 @@
   }
   fclose (f);
+  return true;
 }
 
@@ -154,9 +155,6 @@
 {
 
-    int i, j;
-    FILE *f;
-    psVector *params;
-    psVector *dparams;
-    psModel  *model;
+    int i;
+    FILE *f;
 
     f = fopen (filename, "w");
Index: /trunk/psphot/src/psphot.c
===================================================================
--- /trunk/psphot/src/psphot.c	(revision 4420)
+++ /trunk/psphot/src/psphot.c	(revision 4421)
@@ -3,8 +3,8 @@
 int main (int argc, char **argv) {
 
-    psMetadata  *config  = NULL;		// user-provided configuration information
+    psMetadata  *config  = NULL;
     psImageData *imdata  = NULL;
     psArray     *sources = NULL;
-    psArray     *peaks   = NULL;		// a list of pmPeaks 
+    psArray     *peaks   = NULL;
     pmPSF       *psf     = NULL;
     psStats     *sky     = NULL;
@@ -25,4 +25,5 @@
     sources = source_moments (imdata, config, peaks);
 
+    // classify sources based on moments, brightness
     basic_classes (sources, config);
 
@@ -30,5 +31,5 @@
     sources = psArraySort (sources, by_SN);
 
-    // use stellar objects SN > PSF_SN_LIM
+    // use bright stellar objects to measure PSF
     psf = choose_psf_model (config, sources, sky);
 
@@ -39,8 +40,5 @@
     apply_psf_model (imdata, config, sources, psf, sky);
 
-    // XXX this test compares dSx,dSy distribution with model.
-    // XXX it has some problems
-    // test_psf_scatter (sources);
-
+    // fit extended objects with galaxy models
     // fit_galaxies (imdata, config, sources);
 
Index: /trunk/psphot/src/setup.c
===================================================================
--- /trunk/psphot/src/setup.c	(revision 4420)
+++ /trunk/psphot/src/setup.c	(revision 4421)
@@ -43,5 +43,4 @@
       psFree (file);
     } else {
-      psScalar *value;
 
       noise = psImageAlloc (image->numCols, image->numRows, PS_TYPE_F32);
@@ -54,4 +53,6 @@
       // XXX EAM it looks like psBinaryOp is broken for (image op scalar)
       # if (0)
+      psScalar *value;
+
       value = psScalarAlloc (1.0 / GAIN, PS_TYPE_F64);
       noise = (psImage *) psBinaryOp (NULL, image, "/", value);
