Index: trunk/psModules/src/astrom/pmAstrometryDistortion.c
===================================================================
--- trunk/psModules/src/astrom/pmAstrometryDistortion.c	(revision 41525)
+++ trunk/psModules/src/astrom/pmAstrometryDistortion.c	(revision 41533)
@@ -340,8 +340,12 @@
     psRegion *region = pmAstromFPAExtent (fpa);
 
+    // XXX psFree (fpa->fromTPA);
+    // XXX psPlaneTransform *myPT = psPlaneTransformAlloc(fpa->toTPA->x->nX+4, fpa->toTPA->x->nY+4);
+    // XXX fpa->fromTPA = psPlaneTransformInvert(myPT, fpa->toTPA, *region, 50);
+    // XXX psFree (myPT);
+
+    // as of r40806, psPlaneTransformInvert supplies the extra order (if non-linear)
     psFree (fpa->fromTPA);
-    psPlaneTransform *myPT = psPlaneTransformAlloc(fpa->toTPA->x->nX+4, fpa->toTPA->x->nY+4);
-    fpa->fromTPA = psPlaneTransformInvert(myPT, fpa->toTPA, *region, 50);
-    psFree (myPT);
+    fpa->fromTPA = psPlaneTransformInvert(NULL, fpa->toTPA, *region, 50, 4);
     psFree (region);
 
Index: trunk/psModules/src/astrom/pmAstrometryModel.c
===================================================================
--- trunk/psModules/src/astrom/pmAstrometryModel.c	(revision 41525)
+++ trunk/psModules/src/astrom/pmAstrometryModel.c	(revision 41533)
@@ -518,15 +518,13 @@
 
     // convert the toFPA transfomations to fromFPA transformations
-    // we need a higher order transformation to model the inverse transformation
-    // is +4 too large?
-    // XXX EAM : hold off on high-order inverse chip fromFPA
     for (int i = 0; i < file->fpa->chips->n; i++) {
         pmChip *chip = file->fpa->chips->data[i];
         if (!chip->toFPA) continue;
         psRegion *region = pmChipPixels (chip);
+
+	// as of r40806, psPlaneTransformInvert supplies the extra order (if non-linear)
         psFree (chip->fromFPA);
-//	psPlaneTransform *myPT = psPlaneTransformAlloc(chip->toFPA->x->nX+4, chip->toFPA->x->nY+4);
-	psPlaneTransform *myPT = NULL;
-        chip->fromFPA = psPlaneTransformInvert(myPT, chip->toFPA, *region, 50);
+        chip->fromFPA = psPlaneTransformInvert(NULL, chip->toFPA, *region, 50, 4);
+
         psFree (region);
     }
@@ -586,8 +584,13 @@
 
     psRegion *region = pmAstromFPAExtent (file->fpa);
+
+    // XXX psFree (file->fpa->fromTPA);
+    // XXX psPlaneTransform *myPT = psPlaneTransformAlloc(file->fpa->toTPA->x->nX+4, file->fpa->toTPA->x->nY+4);
+    // XXX file->fpa->fromTPA = psPlaneTransformInvert(myPT, file->fpa->toTPA, *region, 50);
+    // XXX psFree (myPT);
+
+    // as of r40806, psPlaneTransformInvert supplies the extra order (if non-linear)
     psFree (file->fpa->fromTPA);
-    psPlaneTransform *myPT = psPlaneTransformAlloc(file->fpa->toTPA->x->nX+4, file->fpa->toTPA->x->nY+4);
-    file->fpa->fromTPA = psPlaneTransformInvert(myPT, file->fpa->toTPA, *region, 50);
-    psFree (myPT);
+    file->fpa->fromTPA = psPlaneTransformInvert(NULL, file->fpa->toTPA, *region, 50, 4);
 
     psFree (model);
@@ -735,8 +738,13 @@
     // the inverse transformation requires a higher order model to fit the direct transformation sufficiently well
     psRegion *region = pmAstromFPAExtent (file->fpa);
+
+    // XXX psFree (file->fpa->fromTPA);
+    // XXX psPlaneTransform *myPT = psPlaneTransformAlloc(file->fpa->toTPA->x->nX+4, file->fpa->toTPA->x->nY+4);
+    // XXX file->fpa->fromTPA = psPlaneTransformInvert(myPT, file->fpa->toTPA, *region, 50);
+    // XXX psFree (myPT);
+
     psFree (file->fpa->fromTPA);
-    psPlaneTransform *myPT = psPlaneTransformAlloc(file->fpa->toTPA->x->nX+4, file->fpa->toTPA->x->nY+4);
-    file->fpa->fromTPA = psPlaneTransformInvert(myPT, file->fpa->toTPA, *region, 50);
-    psFree (myPT);
+    file->fpa->fromTPA = psPlaneTransformInvert(NULL, file->fpa->toTPA, *region, 50, 4);
+
     psFree (region);
 
Index: trunk/psModules/src/astrom/pmAstrometryWCS.c
===================================================================
--- trunk/psModules/src/astrom/pmAstrometryWCS.c	(revision 41525)
+++ trunk/psModules/src/astrom/pmAstrometryWCS.c	(revision 41533)
@@ -606,7 +606,7 @@
     psRegion *region = pmChipPixels (chip);
 
+    // as of r40806, psPlaneTransformInvert supplies the extra order (if non-linear)
     psFree (chip->fromFPA);
-    assert (chip->fromFPA == NULL);
-    chip->fromFPA = psPlaneTransformInvert(NULL, chip->toFPA, *region, 50);
+    chip->fromFPA = psPlaneTransformInvert(NULL, chip->toFPA, *region, 50, 4);
     psFree (region);
 
@@ -666,6 +666,7 @@
     psRegion *region = pmChipPixels (chip);
 
+    // as of r40806, psPlaneTransformInvert supplies the extra order (if non-linear)
     psFree (chip->fromFPA);
-    chip->fromFPA = psPlaneTransformInvert(NULL, chip->toFPA, *region, 50);
+    chip->fromFPA = psPlaneTransformInvert(NULL, chip->toFPA, *region, 50, 4);
     psFree (region);
 
@@ -691,4 +692,8 @@
         }
     }
+
+    // XXX the way this is coded, updates will NOT have the same behavior as with the
+    // original code: the if ADDITIONAL_WCS_ORDERS is not found, the default
+    // should be 0 (or else we need some way to detect the update version)
 
     // the transformation used the region to define the inversion grid
@@ -701,9 +706,5 @@
       additional_orders = config_additional_orders; 
     }
-    
-    psPlaneTransform *myPT = psPlaneTransformAlloc(fpa->toTPA->x->nX+additional_orders, fpa->toTPA->x->nY+additional_orders);
-
-    fpa->fromTPA = psPlaneTransformInvert(myPT, fpa->toTPA, region, 50);
-    psFree (myPT);
+    fpa->fromTPA = psPlaneTransformInvert(NULL, fpa->toTPA, region, 50, additional_orders);
     return true;
 }
@@ -1030,5 +1031,6 @@
     }
 
-    psPlaneTransform *outFromFPA = psPlaneTransformInvert(NULL, outToFPA, *outputBounds, 50);
+    // NOTE: the extraOrders value (4) should be ignored since outToFPA is specified to be linear
+    psPlaneTransform *outFromFPA = psPlaneTransformInvert(NULL, outToFPA, *outputBounds, 50, 4);
     if (!outFromFPA) {
         psFree(outToFPA);
@@ -1147,5 +1149,5 @@
 
     // this is a linear transformation
-    psPlaneTransform *newFromFPA = psPlaneTransformInvert(NULL, newToFPA, *bounds, 1);
+    psPlaneTransform *newFromFPA = psPlaneTransformInvert(NULL, newToFPA, *bounds, 1, 0);
     if (!newFromFPA) {
         psFree(newToFPA);
