Index: engine/combination.c
===================================================================
RCS file: /home/arend/Go/gnugo-rsync/gnugo/engine/combination.c,v
retrieving revision 1.56
diff -u -p -r1.56 combination.c
--- engine/combination.c	23 Jan 2006 18:15:50 -0000	1.56
+++ engine/combination.c	2 Feb 2006 18:53:24 -0000
@@ -408,14 +408,14 @@ atari_atari_blunder_size(int color, int 
   memset(forbidden, 0, sizeof(forbidden));
   memset(defense_points, 0, sizeof(defense_points));
 
-  /* FIXME: Maybe these should be moved after the tryko() below? */
-  compute_aa_status(other, safe_stones);
-  compute_aa_values(other);
-
   /* Accept illegal ko capture here. */
   if (!tryko(move, color, NULL))
     /* Really shouldn't happen. */
     abortgo(__FILE__, __LINE__, "trymove", move);
+
+  compute_aa_status(other, safe_stones);
+  compute_aa_values(other);
+
   increase_depth_values();
 
   aa_val = do_atari_atari(other, &apos, &defense_point, defense_points,
Index: engine/move_reasons.c
===================================================================
RCS file: /home/arend/Go/gnugo-rsync/gnugo/engine/move_reasons.c,v
retrieving revision 1.133
diff -u -p -r1.133 move_reasons.c
--- engine/move_reasons.c	23 Jan 2006 18:15:50 -0000	1.133
+++ engine/move_reasons.c	3 Feb 2006 12:34:17 -0000
@@ -1637,7 +1637,8 @@ mark_safe_stones(int color, int move_pos
     else
       safe_stones[pos] = 0;
   }
-  safe_stones[move_pos] = move[move_pos].move_safety;
+  safe_stones[move_pos]
+    = move[move_pos].move_safety && safe_move(move_pos, color) == WIN;
 }
 
 
Index: engine/owl.c
===================================================================
RCS file: /home/arend/Go/gnugo-rsync/gnugo/engine/owl.c,v
retrieving revision 1.243
diff -u -p -r1.243 owl.c
--- engine/owl.c	23 Jan 2006 18:15:50 -0000	1.243
+++ engine/owl.c	2 Feb 2006 18:53:24 -0000
@@ -5957,6 +5957,7 @@ owl_substantial(int str)
   int result;
   double start = 0.0;
   struct local_owl_data *owl;
+  int num_moves = 0;
 
   if (debug & DEBUG_OWL_PERFORMANCE)
     start = gg_cputime();
@@ -5968,7 +5969,6 @@ owl_substantial(int str)
 
   owl->color = OTHER_COLOR(board[str]);
   local_owl_node_counter = 0;
-  gg_assert(stackp == 0);
 
   /* Big strings are always substantial since the biggest nakade is
    * six stones. (There are probably rare exceptions to this
@@ -6008,6 +6008,7 @@ owl_substantial(int str)
       if (get_level() >= 8)
 	increase_depth_values();
       owl->goal[libs[k]] = 1;
+      num_moves++;
     }
     else {
       /* if we can't fill, try swapping with the next liberty */
@@ -6017,10 +6018,11 @@ owl_substantial(int str)
 	  increase_depth_values();
 	owl->goal[libs[k+1]] = 1;
 	libs[k+1] = libs[k];
+	num_moves++;
       }
       else {
 	/* Can't fill the liberties. Give up! */
-	while (stackp > 0) {
+	while (num_moves-- > 0) {
 	  if (get_level() >= 8)
 	    decrease_depth_values();
 	  popgo();
@@ -6041,7 +6043,7 @@ owl_substantial(int str)
     result = 0;
   else
     result = 1;
-  while (stackp > 0) {
+  while (num_moves-- > 0) {
     if (get_level() >= 8)
       decrease_depth_values();
     popgo();

