Index: trunk/pswarp/src/pswarpLoadAstrometry.c
===================================================================
--- trunk/pswarp/src/pswarpLoadAstrometry.c	(revision 39981)
+++ trunk/pswarp/src/pswarpLoadAstrometry.c	(revision 41526)
@@ -150,12 +150,22 @@
 	    }
 	}
-	targetChip->toFPA = psMemIncrRefCounter (chip->toFPA);
-	targetChip->fromFPA = psMemIncrRefCounter (chip->fromFPA);
+	if (targetChip != chip) {
+	  psAssert (!targetChip->toFPA, "oops");
+	  psAssert (!targetChip->fromFPA, "oops");
+	  targetChip->toFPA = psMemIncrRefCounter (chip->toFPA);
+	  targetChip->fromFPA = psMemIncrRefCounter (chip->fromFPA);
+	}
     }
 
     // for pswarpLocalFrame, I need transformations and HDUs on a single fpa (so set on astrom as well as target)
-    target->fpa->toTPA = psMemIncrRefCounter (astrom->fpa->toTPA);
-    target->fpa->fromTPA = psMemIncrRefCounter (astrom->fpa->fromTPA);
-    target->fpa->toSky = psMemIncrRefCounter (astrom->fpa->toSky);
+    // But: do not increment the ref counter if this is the same entry
+    if (target->fpa != astrom->fpa) {
+      psAssert (!target->fpa->toTPA, "oops");
+      psAssert (!target->fpa->fromTPA, "oops");
+      psAssert (!target->fpa->toSky, "oops");
+      target->fpa->toTPA = psMemIncrRefCounter (astrom->fpa->toTPA);
+      target->fpa->fromTPA = psMemIncrRefCounter (astrom->fpa->fromTPA);
+      target->fpa->toSky = psMemIncrRefCounter (astrom->fpa->toSky);
+    }
 
     // reset the type to the original value
