Index: trunk/psModules/src/astrom/pmAstrometryWCS.c
===================================================================
--- trunk/psModules/src/astrom/pmAstrometryWCS.c	(revision 40553)
+++ 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);
