Index: /branches/eam_branches/ipp-20150616/Ohana/src/addstar/include/loadgalphot.h
===================================================================
--- /branches/eam_branches/ipp-20150616/Ohana/src/addstar/include/loadgalphot.h	(revision 38488)
+++ /branches/eam_branches/ipp-20150616/Ohana/src/addstar/include/loadgalphot.h	(revision 38489)
@@ -4,4 +4,6 @@
   double **b;
   double **c;
+  double **C;
+  double  *B;
   double *Cii;
   int order;
Index: /branches/eam_branches/ipp-20150616/Ohana/src/addstar/src/loadgalphot_fit2d.c
===================================================================
--- /branches/eam_branches/ipp-20150616/Ohana/src/addstar/src/loadgalphot_fit2d.c	(revision 38488)
+++ /branches/eam_branches/ipp-20150616/Ohana/src/addstar/src/loadgalphot_fit2d.c	(revision 38489)
@@ -1,4 +1,5 @@
 # include "addstar.h"
 # include "loadgalphot.h"
+# define VERY_VERBOSE 1
 
 Fit2D *fit2d_init (int order) {
@@ -18,7 +19,10 @@
   ALLOCATE (fit->s, double *, fit->mterm);
   ALLOCATE (fit->b, double *, fit->wterm);
+  ALLOCATE (fit->B, double,   fit->wterm);
   ALLOCATE (fit->c, double *, fit->wterm);
+  ALLOCATE (fit->C, double *, fit->wterm);
   for (i = 0; i < fit->wterm; i++) {
     ALLOCATE_ZERO (fit->c[i], double, fit->wterm);
+    ALLOCATE_ZERO (fit->C[i], double, fit->wterm);
     ALLOCATE_ZERO (fit->b[i], double, 1);
   }
@@ -58,9 +62,12 @@
 
   for (i = 0; i < fit->wterm; i++) {
+    free (fit->C[i]);
     free (fit->c[i]);
     free (fit->b[i]);
   }
   free (fit->b);
+  free (fit->B);
   free (fit->c);
+  free (fit->C);
 
   for (i = 0; i < fit->mterm; i++) {
@@ -137,7 +144,26 @@
     }
 
+# if (VERY_VERBOSE)
+    for (i = 0; i < fit->wterm; i++) {
+      for (j = 0; j < fit->wterm; j++) {
+	fit->C[i][j] = fit->c[i][j];
+      }
+      fit->B[i] = fit->b[i][0];
+    }
+# endif
+
     // invert the c,b matrix equation
     status = dgaussjordan (fit->c, fit->b, fit->wterm, 1);
-    if (!status) return FALSE;
+    if (!status) {
+# if (VERY_VERBOSE)
+      for (i = 0; i < fit->wterm; i++) {
+	for (j = 0; j < fit->wterm; j++) {
+	  fprintf (stderr, "%10.3e ", fit->C[i][j]);
+	}
+	fprintf (stderr, " : %10.3e\n", fit->B[i]);
+      }
+# endif
+      return FALSE;
+    }
 
     /* the b[][0] terms are in the following order:
