diff --git a/tracy/tracy/src/soleillib.cc b/tracy/tracy/src/soleillib.cc
index 917d554b8dbed364243ba131f63c6b660bb520cb..5579dc553d735926e962995cbef5210fd2c9cb3c 100644
--- a/tracy/tracy/src/soleillib.cc
+++ b/tracy/tracy/src/soleillib.cc
@@ -3001,7 +3001,8 @@ void SetSkewQuad(void)
 	         since the Cell_Pass( ) is tracking from element i0 to i1(tracy 3), and
 		       the Cell_Pass( ) is tracking from element i0+1L to i1(tracy 2).
 	   17/04/11 add number of turn
-                                                             		
+        27/06/11  fix the bug of the index in the tabz and tabpz when calling Trac( ); 
+                 fix the bug in the vertical closed orbit when calling Trac( ).                                                     		
 ****************************************************************************/
 void MomentumAcceptance(long deb, long fin, double ep_min, double ep_max,
 			long nstepp, double em_min, double em_max, long nstepm, long nturn)
@@ -3170,7 +3171,7 @@ void MomentumAcceptance(long deb, long fin, double ep_min, double ep_max,
       if (trace)  printf("i=%4ld pos=%4ld dp=%6.4g\n",i,pos,dp2);
       if (0) fprintf(stdout,"pos=%4ld z0 =% 10.5f  pz0 =% 10.5f  \n", pos, tabz0[i-1L][pos-1L], tabpz0[i-1L][pos-1L]);
       
-      Trac(x, px, tabz0[i-1L][pos], tabpz0[i-1L][pos-1L], dp2+delta , ctau0, nturn, pos, lastn, lastpos, outf1);
+      Trac(x, px, z+tabz0[i-1L][pos-1L], pz+tabpz0[i-1L][pos-1L], dp2+delta , ctau0, nturn, pos, lastn, lastpos, outf1);
     
     }while (((lastn) == nturn) && (i != nstepp));
             
@@ -3320,7 +3321,7 @@ void MomentumAcceptance(long deb, long fin, double ep_min, double ep_max,
         dp2 = em_max;
       }
       if (trace) printf("i=%4ld pos=%4ld dp=%6.4g\n",i,pos,dp2);
-      Trac(x, px, tabz0[i-1L][pos], tabpz0[i-1L][pos-1L], dp2+delta , ctau0, nturn, pos, lastn, lastpos, outf1);
+      Trac(x, px, z+tabz0[i-1L][pos-1L], pz+tabpz0[i-1L][pos-1L], dp2+delta , ctau0, nturn, pos, lastn, lastpos, outf1);
     }
     while (((lastn) == nturn) && (i != nstepm));
 
@@ -4211,7 +4212,7 @@ void Coupling_Edwards_Teng(void)
   S[0][1] = 1.0; S[1][0] = -1.0;
 
   /* Compute invariants */
-  GetEmittance(ElemIndex("cav"), true);
+  GetEmittance(globval.cav, true);
  
   
   /* Set everything to 4D integrator */