Index: engine/aftermath.c
===================================================================
RCS file: /home/arend/Go/gnugo-rsync/gnugo/engine/aftermath.c,v
retrieving revision 1.61
diff -u -p -r1.61 aftermath.c
--- engine/aftermath.c	18 May 2006 03:54:42 -0000	1.61
+++ engine/aftermath.c	25 Jan 2007 20:22:28 -0000
@@ -2,7 +2,7 @@
  * This is GNU Go, a Go program. Contact gnugo@gnu.org, or see       *
  * http://www.gnu.org/software/gnugo/ for more information.          *
  *                                                                   *
- * Copyright 1999, 2000, 2001, 2002, 2003, 2004, 2005 and 2006       *
+ * Copyright 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2006 and 2007 *
  * by the Free Software Foundation.                                  *
  *                                                                   *
  * This program is free software; you can redistribute it and/or     *
@@ -490,7 +490,7 @@ do_aftermath_genmove(int color,
 	  safety = INVINCIBLE;
 	
 	if (k < 4) {
-	  int apos = worm[pos2].origin;
+	  int apos = find_origin(pos2);
 	  
 	  if (!mx[apos]) {
 	    own_worms++;
Index: engine/combination.c
===================================================================
RCS file: /home/arend/Go/gnugo-rsync/gnugo/engine/combination.c,v
retrieving revision 1.57
diff -u -p -r1.57 combination.c
--- engine/combination.c	4 Feb 2006 10:17:17 -0000	1.57
+++ engine/combination.c	25 Jan 2007 20:21:10 -0000
@@ -572,8 +572,8 @@ compute_aa_status(int color, const signe
    */
   for (pos = BOARDMIN; pos < BOARDMAX; pos++) {
     if (board[pos] == other
-	&& worm[pos].origin == pos
-	&& worm[pos].liberties == 2
+	&& find_origin(pos) == pos
+	&& countlib(pos) == 2
 	&& aa_status[pos] == ALIVE) {
       int libs[2];
       findlib(pos, 2, libs);
@@ -587,7 +587,7 @@ compute_aa_status(int color, const signe
       if (!owl_substantial(pos)) {
 	int pos2;
 	for (pos2 = BOARDMIN; pos2 < BOARDMAX; pos2++)
-	  if (ON_BOARD(pos2) && is_worm_origin(pos2, pos))
+	  if (IS_STONE(board[pos2]) && is_worm_origin(pos2, pos))
 	    aa_status[pos2] = INSUBSTANTIAL;
       }
     }
Index: engine/liberty.h
===================================================================
RCS file: /home/arend/Go/gnugo-rsync/gnugo/engine/liberty.h,v
retrieving revision 1.260
diff -u -p -r1.260 liberty.h
--- engine/liberty.h	20 Jan 2007 22:14:06 -0000	1.260
+++ engine/liberty.h	25 Jan 2007 20:21:10 -0000
@@ -803,6 +803,7 @@ extern struct half_eye_data half_eye[BOA
 
 #define MAX_TACTICAL_POINTS 10
 
+/* all this data is valid only, when stackp==0 */
 struct worm_data {
   int color;         /* its color */
   int size;          /* its cardinality */
Index: engine/owl.c
===================================================================
RCS file: /home/arend/Go/gnugo-rsync/gnugo/engine/owl.c,v
retrieving revision 1.252
diff -u -p -r1.252 owl.c
--- engine/owl.c	13 Jan 2007 13:26:52 -0000	1.252
+++ engine/owl.c	25 Jan 2007 20:58:44 -0000
@@ -454,7 +454,7 @@ owl_analyze_semeai_after_move(int move, 
   if (verbose > 0)
     verbose--;
   for (str = BOARDMIN; str < BOARDMAX; str++) 
-    if (ON_BOARD(str) && ms[str] && worm[str].origin == str) {
+    if (ON_BOARD(str) && ms[str] && find_origin(str) == str) {
       int adj;
       int adjs[MAXCHAIN];
       int k;
@@ -4616,10 +4616,14 @@ owl_mark_worm(int apos, int bpos, struct
   int color = board[apos];
   
   ASSERT1(bpos == NO_MOVE || board[bpos] == color, bpos);
+  apos = find_origin(apos);
+  if (bpos != NO_MOVE)
+    bpos = find_origin(bpos);
 
   for (pos = BOARDMIN; pos < BOARDMAX; pos++)
     if (ON_BOARD(pos)) {
-      if (is_same_worm(pos, apos) || is_same_worm(pos, bpos))
+      if (IS_STONE(board[pos])
+	  && (find_origin(pos) == apos || find_origin(pos) == bpos))
 	owl->goal[pos] = 1;
       else
 	owl->goal[pos] = 0;
@@ -6898,8 +6902,8 @@ list_goal_worms(struct local_owl_data *o
 	continue;
 
       for (ii = BOARDMIN; ii < BOARDMAX && w < MAX_GOAL_WORMS; ii++)
-	if (ON_BOARD(ii) && board[ii] && worm[ii].origin == ii
-	    && worm[ii].size >= 3 && dragon[ii].id == d)
+	if (IS_STONE(board[ii]) && find_origin(ii) == ii
+	    && countstones(ii) >= 3 && dragon[ii].id == d)
 	  goal_worm[w++] = ii;
     }
   }
