Index: kernel/kstd1.cc
===================================================================
--- kernel/kstd1.cc	(revision 0033111f9b9caf502a298c422c3cbea31cee1927)
+++ kernel/kstd1.cc	(revision eafa0edca582876575051b2b543608fd75a2bd48)
@@ -134,5 +134,4 @@
 static int doRed (LObject* h, TObject* with,BOOLEAN intoT,kStrategy strat)
 {
-  poly hp;
   int ret;
 #if KDEBUG > 0
@@ -182,5 +181,4 @@
 int redEcart (LObject* h,kStrategy strat)
 {
-  poly pi;
   int i,at,ei,li,ii;
   int j = 0;
@@ -930,5 +928,5 @@
     //if (TEST_OPT_WEIGHTM)
     //{
-    //  pRestoreDegProcs(currRing,pFDegOld, pLDegOld);
+    //  pRestoreDegProcs(currRing,strat->pOrigFDeg, strat->pOrigLDeg);
     //  if (strat->tailRing != currRing)
     //  {
@@ -983,5 +981,4 @@
 void enterSMora (LObject p,int atS,kStrategy strat, int atR = -1)
 {
-  int i;
   enterSBba(p, atS, strat, atR);
   #ifdef KDEBUG
@@ -1037,6 +1034,4 @@
 void enterSMoraNF (LObject p, int atS,kStrategy strat, int atR = -1)
 {
-  int i;
-
   enterSBba(p, atS, strat, atR);
   if ((!strat->kHEdgeFound) || (strat->kNoether!=NULL)) HEckeTest(p.p,strat);
@@ -1049,6 +1044,4 @@
 void initBba(ideal F,kStrategy strat)
 {
-  int i;
-  idhdl h;
  /* setting global variables ------------------- */
   strat->enterS = enterSBba;
@@ -1080,6 +1073,6 @@
 //  {
 //    //interred  machen   Aenderung
-//    pFDegOld=pFDeg;
-//    pLDegOld=pLDeg;
+//    strat->pOrigFDeg=pFDeg;
+//    strat->pOrigLDeg=pLDeg;
 //    //h=ggetid("ecart");
 //    //if ((h!=NULL) /*&& (IDTYP(h)==INTVEC_CMD)*/)
@@ -1107,5 +1100,4 @@
 {
   int i,j;
-  idhdl h;
 
   strat->NotUsedAxis = (BOOLEAN *)omAlloc(((currRing->N)+1)*sizeof(BOOLEAN));
@@ -1135,30 +1127,22 @@
    *intvec ecart and set ecartWeights
    */
-//  if ((TEST_OPT_WEIGHTM)&&(F!=NULL))
-//  {
-//    //interred  machen   Aenderung
-//    pFDegOld=pFDeg;
-//    pLDegOld=pLDeg;
-//    //h=ggetid("ecart");
-//    //if ((h!=NULL) /*&& (IDTYP(h)==INTVEC_CMD)*/)
-//    //{
-//    //  ecartWeights=iv2array(IDINTVEC(h));
-//    //}
-//    //else
-//    {
-//      ecartWeights=(short *)omAlloc(((currRing->N)+1)*sizeof(short));
-//      /*uses automatic computation of the ecartWeights to set them*/
-//      kEcartWeights(F->m,IDELEMS(F)-1,ecartWeights);
-//    }
-//
-//    pSetDegProcs(currRing,totaldegreeWecart, maxdegreeWecart);
-//    if (TEST_OPT_PROT)
-//    {
-//      for(i=1; i<=(currRing->N); i++)
-//        Print(" %d",ecartWeights[i]);
-//      PrintLn();
-//      mflush();
-//    }
-//  }
+  if ((TEST_OPT_WEIGHTM)&&(F!=NULL))
+  {
+    //interred  machen   Aenderung
+    strat->pOrigFDeg=currRing->pFDeg;
+    strat->pOrigLDeg=currRing->pLDeg;
+    ecartWeights=(short *)omAlloc(((currRing->N)+1)*sizeof(short));
+    /*uses automatic computation of the ecartWeights to set them*/
+    kEcartWeights(F->m,IDELEMS(F)-1,ecartWeights,currRing);
+
+    pSetDegProcs(currRing,totaldegreeWecart, maxdegreeWecart);
+    if (TEST_OPT_PROT)
+    {
+      for(i=1; i<=(currRing->N); i++)
+        Print(" %d",ecartWeights[i]);
+      PrintLn();
+      mflush();
+    }
+  }
   kOptimizeLDeg(currRing->pLDeg, strat);
 }
@@ -1404,5 +1388,5 @@
 //  if (TEST_OPT_WEIGHTM)
 //  {
-//    pRestoreDegProcs(currRing,pFDegOld, pLDegOld);
+//    pRestoreDegProcs(currRing,strat->pOrigFDeg, strat->pOrigLDeg);
 //    if (ecartWeights)
 //    {
@@ -1532,5 +1516,5 @@
 //  if ((TEST_OPT_WEIGHTM)&&(F!=NULL))
 //  {
-//    pRestoreDegProcs(currRing,pFDegOld, pLDegOld);
+//    pRestoreDegProcs(currRing,strat->pOrigFDeg, strat->pOrigLDeg);
 //    if (ecartWeights)
 //    {
@@ -1670,6 +1654,6 @@
 //  if ((TEST_OPT_WEIGHTM)&&(F!=NULL))
 //  {
-//    pFDeg=pFDegOld;
-//    pLDeg=pLDegOld;
+//    pFDeg=strat->pOrigFDeg;
+//    pLDeg=strat->pOrigLDeg;
 //    if (ecartWeights)
 //    {
@@ -1684,6 +1668,4 @@
 }
 
-pFDegProc pFDegOld;
-pLDegProc pLDegOld;
 intvec * kModW, * kHomW;
 
@@ -1740,6 +1722,6 @@
     currRing->pLexOrder=FALSE;
     strat->kHomW=kHomW=vw;
-    pFDegOld = currRing->pFDeg;
-    pLDegOld = currRing->pLDeg;
+    strat->pOrigFDeg = currRing->pFDeg;
+    strat->pOrigLDeg = currRing->pLDeg;
     pSetDegProcs(currRing,kHomModDeg);
     toReset = TRUE;
@@ -1765,6 +1747,6 @@
       if (vw == NULL)
       {
-        pFDegOld = currRing->pFDeg;
-        pLDegOld = currRing->pLDeg;
+        strat->pOrigFDeg = currRing->pFDeg;
+        strat->pOrigLDeg = currRing->pLDeg;
         pSetDegProcs(currRing,kModDeg);
         toReset = TRUE;
@@ -1827,5 +1809,5 @@
   {
     kModW = NULL;
-    pRestoreDegProcs(currRing,pFDegOld, pLDegOld);
+    pRestoreDegProcs(currRing,strat->pOrigFDeg, strat->pOrigLDeg);
   }
   currRing->pLexOrder = b;
@@ -1862,6 +1844,6 @@
     currRing->pLexOrder=FALSE;
     strat->kHomW=kHomW=vw;
-    pFDegOld = currRing->pFDeg;
-    pLDegOld = currRing->pLDeg;
+    strat->pOrigFDeg = currRing->pFDeg;
+    strat->pOrigLDeg = currRing->pLDeg;
     pSetDegProcs(currRing,kHomModDeg);
     toReset = TRUE;
@@ -1887,6 +1869,6 @@
       if (vw == NULL)
       {
-        pFDegOld = currRing->pFDeg;
-        pLDegOld = currRing->pLDeg;
+        strat->pOrigFDeg = currRing->pFDeg;
+        strat->pOrigLDeg = currRing->pLDeg;
         pSetDegProcs(currRing,kModDeg);
         toReset = TRUE;
@@ -1920,5 +1902,5 @@
   {
     kModW = NULL;
-    pRestoreDegProcs(currRing,pFDegOld, pLDegOld);
+    pRestoreDegProcs(currRing,strat->pOrigFDeg, strat->pOrigLDeg);
   }
   currRing->pLexOrder = b;
@@ -1988,6 +1970,6 @@
       strat->kModW = *w;
       assume(currRing->pFDeg != NULL && currRing->pLDeg != NULL);
-      pFDegOld = currRing->pFDeg;
-      pLDegOld = currRing->pLDeg;
+      strat->pOrigFDeg = currRing->pFDeg;
+      strat->pOrigLDeg = currRing->pLDeg;
       pSetDegProcs(currRing,kModDeg);
 
@@ -2031,5 +2013,5 @@
   if (toReset)
   {
-    pRestoreDegProcs(currRing,pFDegOld, pLDegOld);
+    pRestoreDegProcs(currRing,strat->pOrigFDeg, strat->pOrigLDeg);
     kModW = NULL;
   }
@@ -2297,6 +2279,6 @@
     {
       strat->kModW = kModW = w;
-      pFDegOld = currRing->pFDeg;
-      pLDegOld = currRing->pLDeg;
+      strat->pOrigFDeg = currRing->pFDeg;
+      strat->pOrigLDeg = currRing->pLDeg;
       pSetDegProcs(currRing,kModDeg);
       toReset = TRUE;
@@ -2359,5 +2341,4 @@
     else
     {
-      int deg_before=olddeg;
       if (TEST_OPT_PROT)
         message(strat->P.pFDeg(),
@@ -2504,5 +2485,5 @@
 //  if (TEST_OPT_WEIGHTM)
 //  {
-//    pRestoreDegProcs(currRing,pFDegOld, pLDegOld);
+//    pRestoreDegProcs(currRing,strat->pOrigFDeg, strat->pOrigLDeg);
 //    if (ecartWeights)
 //    {
Index: kernel/kstd1.h
===================================================================
--- kernel/kstd1.h	(revision 0033111f9b9caf502a298c422c3cbea31cee1927)
+++ kernel/kstd1.h	(revision eafa0edca582876575051b2b543608fd75a2bd48)
@@ -55,6 +55,4 @@
 
 
-extern pFDegProc pFDegOld;
-extern pLDegProc pLDegOld;
 extern intvec * kModW;
 extern intvec * kHomW;
Index: kernel/kstdfac.cc
===================================================================
--- kernel/kstdfac.cc	(revision 0033111f9b9caf502a298c422c3cbea31cee1927)
+++ kernel/kstdfac.cc	(revision eafa0edca582876575051b2b543608fd75a2bd48)
@@ -878,8 +878,7 @@
   /* complete reduction of the standard basis--------- */
   /* release temp data-------------------------------- */
-  exitBuchMora(strat);
   if (TEST_OPT_WEIGHTM)
   {
-    pRestoreDegProcs(currRing,pFDegOld, pLDegOld);
+    pRestoreDegProcs(currRing,strat->pOrigFDeg, strat->pOrigLDeg);
     if (ecartWeights)
     {
@@ -888,4 +887,5 @@
     }
   }
+  exitBuchMora(strat);
   if (TEST_OPT_PROT) { PrintLn(); messageStat(srmax,lrmax,0,strat); }
   if (Q!=NULL) updateResult(strat->Shdl,Q,strat);
@@ -926,6 +926,6 @@
       kModW = *w;
       strat->kModW = *w;
-      pFDegOld = currRing->pFDeg;
-      pLDegOld = currRing->pLDeg;
+      strat->pOrigFDeg = currRing->pFDeg;
+      strat->pOrigLDeg = currRing->pLDeg;
       pSetDegProcs(currRing,kModDeg);
       toReset = TRUE;
@@ -1029,5 +1029,5 @@
   if (toReset)
   {
-    pRestoreDegProcs(currRing,pFDegOld, pLDegOld);
+    pRestoreDegProcs(currRing,strat->pOrigFDeg, strat->pOrigLDeg);
     kModW = NULL;
   }
