Index: trunk/pois/python/pois.py
===================================================================
--- trunk/pois/python/pois.py	(revision 3811)
+++ trunk/pois/python/pois.py	(revision 3813)
@@ -218,12 +218,13 @@
         for s in range(0, stamps.n):
 	    stamp = pois.poisStamp_Cast(stamps.get_data(s)) # Stamp of interest
-            if stamp.status == pois.POIS_STAMP_BAD:
-                ctype = "red"; dotType = "x"
-            else:
-                ctype = "green"; dotType = "+"
-		numStamps += 1
-
-            if display['stamps']:
-                ds9.dot(dotType, stamp.x, stamp.y, size = 5, ctype = ctype, frame = 1)
+            if stamp:
+                if stamp.status == pois.POIS_STAMP_BAD:
+                    ctype = "red"; dotType = "x"
+                else:
+                    ctype = "green"; dotType = "+"
+                    numStamps += 1
+                    
+                if display['stamps']:
+                    ds9.dot(dotType, stamp.x, stamp.y, size = 5, ctype = ctype, frame = 1)
 
 	psTrace("pois.time", 1, ("%d stamps found at %f sec\n" % (numStamps, getTime() - startTime)))
@@ -266,12 +267,16 @@
 						       kernelBasisFunctions, solution, config)
         # Have we converged?
-        if not pois.poisRejectStamps(stamps, mask, deviations, config):
+        rejected = pois.poisRejectStamps(stamps, mask, deviations, config)
+
+        if rejected == None:
             break
-
+        
         if display['stamps']:
-            for s in range(0, stamps.n):
-                stamp = pois.poisStamp_Cast(stamps.get_data(s)) # Stamp of interest
-                if stamp.status == pois.POIS_STAMP_RESET:
-                    ds9.dot("o", stamp.x, stamp.y, size = 5, ctype = "red", frame = 1)
+            iter = psLib.psListIteratorAlloc(rejected, psLib.PS_LIST_HEAD, False)
+            while True:
+                stamp = pois.poisStamp_Cast(psLib.psListGetAndIncrement(iter))
+                if not stamp:
+                    break
+                ds9.dot("o", stamp.x, stamp.y, size = 5, ctype = "red", frame = 1)
 
         if display['pause']:
