diff --git a/tracy/tracy/src/soleillib.cc b/tracy/tracy/src/soleillib.cc
index 78aa4d3471fd2340feacf073d6d46427d1a64ca4..bea629725192a10b2fc3254fb8963805772297f9 100644
--- a/tracy/tracy/src/soleillib.cc
+++ b/tracy/tracy/src/soleillib.cc
@@ -562,6 +562,9 @@ void DefineCh(void)
    Comments:
        This function works providing that the makers have unique names into
        the lattice
+       
+       This function is from Tracy 2, and useless here, since user can define
+       the vacuum chamber using ReadCh() 
 
 ****************************************************************************/
 void DefineChNoU20(void)
@@ -619,6 +622,9 @@ void DefineChNoU20(void)
       Cell[i].maxampl[Y_][1] =  7.0e-3;
     }
   }
+
+  // turn on the global flag for CheckAmpl()
+  globval.Aperture_on = true;
 }
 
 /****************************************************************************/
@@ -678,8 +684,11 @@ void ReadCh(const char *AperFile)
   printf("Loading and setting vacuum apertures to lattice elements...\n");
 
   while (fgets(line, max_str, fp) != NULL) {
-    LineNum++;  /* count the line number that has been read*/
-    if (strstr(line, "#") == NULL)
+    /* count the line number that has been read*/
+    LineNum++;  
+    /* NOT read comment line or blank line with the end of line symbol '\n','\r' or '\r\n'*/
+    if (strstr(line, "#") == NULL && strcmp(line,"\n") != 0 &&
+        strcmp(line,"\r") != 0 &&strcmp(line,"\r\n") != 0)
     /* read the aperture setting */ 
     {
       sscanf(line,"%s %s %lf %lf %lf %lf",
@@ -747,6 +756,9 @@ void ReadCh(const char *AperFile)
  //     printf("%s", line);
   } 
   fclose(fp);
+  // turn on the global flag for CheckAmpl()
+  globval.Aperture_on = true;
+  
 }
 
 /****************************************************************************/
@@ -4402,7 +4414,7 @@ void Coupling_Edwards_Teng(void)
   /* Compute invariants */
   GetEmittance(ElemIndex("cav"), true);
  
- 
+  
   /* Set everything to 4D integrator */
   radiationflag        = globval.radiation;
   cavityflag           = globval.Cavity_on;  
@@ -5200,11 +5212,14 @@ void set_RFVoltage(const int Fnum, const double V_RF){
        
    Comments:
        10/2010  Written by Jianfeng Zhang
+       01/2011  Fix the bug for reading the end of line symbol "\n" , "\r",'\r\n' 
+	        at different operation system
 *****************************************************************************************************/
 void ReadFieldErr(const char *FieldErrorFile) 
 {  
   char    line[max_str], name[max_str], *prm;
   int     n = 0;    /* field error order*/
+  int     LineNum = 0;
   double  Bn = 0.0, An = 0.0, r0 = 0.0; /* field error components and radius when the field error is measured */
   /* conversion number from A to T.m for soleil*/
   double  _convHcorr = 8.14e-4,_convVcorr = 4.642e-4, _convQt = 93.83e-4;
@@ -5217,8 +5232,10 @@ void ReadFieldErr(const char *FieldErrorFile)
   printf("\n");
   /* read lines*/
   while (fgets(line, max_str, inf) != NULL) {
+    LineNum++;
     /* check the line is whether comment line or null line*/
-    if (strstr(line, "#") == NULL && strcmp(line,"\n") != 0) {
+    if (strstr(line, "#") == NULL && strcmp(line,"\n") != 0 &&
+         strcmp(line,"\r") != 0 &&strcmp(line,"\r\n") != 0) {
         /*read and assign the key words and measure radius*/
         sscanf(line, "%s", name); 
 	sscanf(line, " %*s %lf", &r0);
@@ -5227,8 +5244,10 @@ void ReadFieldErr(const char *FieldErrorFile)
 	strtok(line, " \t");
 	strtok(NULL, " \t");
 	
-	while (((prm = strtok(NULL, " \t")) != NULL) &&
-	       (strcmp(prm, "\n") != 0)) {
+	/* read the end of line symbol '\n','\r','\r\n' at different operation system*/
+	while ((prm = strtok(NULL, " \t")) != NULL && strcmp(prm, "\n") != 0 &&
+	       strcmp(prm, "\r") != 0 && strcmp(prm, "\r\n") != 0) {
+	       
 	  /* read and assign n Bn An*/
 	  sscanf(prm, "%d", &n);
 	  prm = get_prm(); /*move the pointer to the next block of the line, delimiter is table key */
@@ -5236,6 +5255,8 @@ void ReadFieldErr(const char *FieldErrorFile)
 	  prm = get_prm(); 
 	  sscanf(prm, "%lf", &An);
 	  
+	  
+	  
 	  if (prt)
 	    printf(" n = %2d, Bn = %9.1e, An = %9.1e\n", n, Bn, An);