Index: factory/cfModGcd.cc
===================================================================
--- factory/cfModGcd.cc	(revision ea1479887fc82285160a87ce7bdcd3ec4659fba9)
+++ factory/cfModGcd.cc	(revision 7cdd912b9b6c44ae159128e2ef64cbaede6f8351)
@@ -584,6 +584,7 @@
   topLevel= false;
   bool inextension= false;
-  Variable V_buf= alpha;
+  Variable V_buf= alpha, V_buf4= alpha;
   CanonicalForm prim_elem, im_prim_elem;
+  CanonicalForm prim_elem_alpha, im_prim_elem_alpha;
   CFList source, dest;
   int bound1= degree (ppA, 1);
@@ -601,22 +602,24 @@
       bool prim_fail= false;
       Variable V_buf2;
-      prim_elem= primitiveElement (alpha, V_buf2, prim_fail);
-
-      if (V_buf3 != alpha)
-      {
-        m= mapDown (m, prim_elem, im_prim_elem, alpha, source, dest);
-        G_m= mapDown (G_m, prim_elem, im_prim_elem, alpha, source, dest);
-        coF_m= mapDown (coF_m, prim_elem, im_prim_elem, alpha, source, dest);
-        coG_m= mapDown (coG_m, prim_elem, im_prim_elem, alpha, source, dest);
-        newtonPoly= mapDown (newtonPoly, prim_elem, im_prim_elem, alpha,
+      prim_elem= primitiveElement (V_buf4, V_buf2, prim_fail);
+      if (V_buf4 == alpha)
+        prim_elem_alpha= prim_elem;
+
+      if (V_buf3 != V_buf4)
+      {
+        m= mapDown (m, prim_elem, im_prim_elem, V_buf4, source, dest);
+        G_m= mapDown (G_m, prim_elem, im_prim_elem, V_buf4, source, dest);
+        coF_m= mapDown (coF_m, prim_elem, im_prim_elem, V_buf4, source, dest);
+        coG_m= mapDown (coG_m, prim_elem, im_prim_elem, V_buf4, source, dest);
+        newtonPoly= mapDown (newtonPoly, prim_elem, im_prim_elem, V_buf4,
                              source, dest);
-        ppA= mapDown (ppA, prim_elem, im_prim_elem, alpha, source, dest);
-        ppB= mapDown (ppB, prim_elem, im_prim_elem, alpha, source, dest);
-        gcdlcAlcB= mapDown (gcdlcAlcB, prim_elem, im_prim_elem, alpha,
+        ppA= mapDown (ppA, prim_elem, im_prim_elem, V_buf4, source, dest);
+        ppB= mapDown (ppB, prim_elem, im_prim_elem, V_buf4, source, dest);
+        gcdlcAlcB= mapDown (gcdlcAlcB, prim_elem, im_prim_elem, V_buf4,
                             source, dest);
-        lcA= mapDown (lcA, prim_elem, im_prim_elem, alpha, source, dest);
-        lcB= mapDown (lcB, prim_elem, im_prim_elem, alpha, source, dest);
+        lcA= mapDown (lcA, prim_elem, im_prim_elem, V_buf4, source, dest);
+        lcB= mapDown (lcB, prim_elem, im_prim_elem, V_buf4, source, dest);
         for (CFListIterator i= l; i.hasItem(); i++)
-          i.getItem()= mapDown (i.getItem(), prim_elem, im_prim_elem, alpha,
+          i.getItem()= mapDown (i.getItem(), prim_elem, im_prim_elem, V_buf4,
                                 source, dest);
       }
@@ -626,24 +629,29 @@
         ; //ERROR
       else
-        im_prim_elem= mapPrimElem (prim_elem, alpha, V_buf);
-
-      DEBOUTLN (cerr, "getMipo (alpha)= " << getMipo (alpha));
+        im_prim_elem= mapPrimElem (prim_elem, V_buf4, V_buf);
+
+      if (V_buf4 == alpha)
+        im_prim_elem_alpha= im_prim_elem;
+      else
+        im_prim_elem_alpha= mapUp (im_prim_elem_alpha, V_buf4, V_buf, prim_elem,
+                                   im_prim_elem, source, dest);
+      DEBOUTLN (cerr, "getMipo (V_buf4)= " << getMipo (V_buf4));
       DEBOUTLN (cerr, "getMipo (V_buf2)= " << getMipo (V_buf2));
       inextension= true;
       for (CFListIterator i= l; i.hasItem(); i++)
-        i.getItem()= mapUp (i.getItem(), alpha, V_buf, prim_elem,
+        i.getItem()= mapUp (i.getItem(), V_buf4, V_buf, prim_elem,
                              im_prim_elem, source, dest);
-      m= mapUp (m, alpha, V_buf, prim_elem, im_prim_elem, source, dest);
-      G_m= mapUp (G_m, alpha, V_buf, prim_elem, im_prim_elem, source, dest);
-      coF_m= mapUp (coF_m, alpha, V_buf, prim_elem, im_prim_elem, source, dest);
-      coG_m= mapUp (coG_m, alpha, V_buf, prim_elem, im_prim_elem, source, dest);
-      newtonPoly= mapUp (newtonPoly, alpha, V_buf, prim_elem, im_prim_elem,
+      m= mapUp (m, V_buf4, V_buf, prim_elem, im_prim_elem, source, dest);
+      G_m= mapUp (G_m, V_buf4, V_buf, prim_elem, im_prim_elem, source, dest);
+      coF_m= mapUp (coF_m, V_buf4, V_buf, prim_elem, im_prim_elem, source, dest);
+      coG_m= mapUp (coG_m, V_buf4, V_buf, prim_elem, im_prim_elem, source, dest);
+      newtonPoly= mapUp (newtonPoly, V_buf4, V_buf, prim_elem, im_prim_elem,
                           source, dest);
-      ppA= mapUp (ppA, alpha, V_buf, prim_elem, im_prim_elem, source, dest);
-      ppB= mapUp (ppB, alpha, V_buf, prim_elem, im_prim_elem, source, dest);
-      gcdlcAlcB= mapUp (gcdlcAlcB, alpha, V_buf, prim_elem, im_prim_elem,
+      ppA= mapUp (ppA, V_buf4, V_buf, prim_elem, im_prim_elem, source, dest);
+      ppB= mapUp (ppB, V_buf4, V_buf, prim_elem, im_prim_elem, source, dest);
+      gcdlcAlcB= mapUp (gcdlcAlcB, V_buf4, V_buf, prim_elem, im_prim_elem,
                          source, dest);
-      lcA= mapUp (lcA, alpha, V_buf, prim_elem, im_prim_elem, source, dest);
-      lcB= mapUp (lcB, alpha, V_buf, prim_elem, im_prim_elem, source, dest);
+      lcA= mapUp (lcA, V_buf4, V_buf, prim_elem, im_prim_elem, source, dest);
+      lcB= mapUp (lcB, V_buf4, V_buf, prim_elem, im_prim_elem, source, dest);
 
       fail= false;
@@ -659,4 +667,5 @@
                             "time for recursive call: ");
       DEBOUTLN (cerr, "G_random_element= " << G_random_element);
+      V_buf4= V_buf;
     }
     else
@@ -684,6 +693,6 @@
       {
         CFList u, v;
-        ppA= mapDown (ppA, prim_elem, im_prim_elem, alpha, u, v);
-        ppB= mapDown (ppB, prim_elem, im_prim_elem, alpha, u, v);
+        ppA= mapDown (ppA, prim_elem_alpha, im_prim_elem_alpha, alpha, u, v);
+        ppB= mapDown (ppB, prim_elem_alpha, im_prim_elem_alpha, alpha, u, v);
       }
       coF= N (ppA*(cA/gcdcAcB));
@@ -753,7 +762,7 @@
           CFList u, v;
           DEBOUTLN (cerr, "ppH before mapDown= " << ppH);
-          ppH= mapDown (ppH, prim_elem, im_prim_elem, alpha, u, v);
-          ppCoF= mapDown (ppCoF, prim_elem, im_prim_elem, alpha, u, v);
-          ppCoG= mapDown (ppCoG, prim_elem, im_prim_elem, alpha, u, v);
+          ppH= mapDown (ppH, prim_elem_alpha, im_prim_elem_alpha, alpha, u, v);
+          ppCoF= mapDown (ppCoF, prim_elem_alpha, im_prim_elem_alpha, alpha, u, v);
+          ppCoG= mapDown (ppCoG, prim_elem_alpha, im_prim_elem_alpha, alpha, u, v);
           DEBOUTLN (cerr, "ppH after mapDown= " << ppH);
           coF= N ((cA/gcdcAcB)*ppCoF);
@@ -1441,4 +1450,5 @@
                             "time for recursive call: ");
       DEBOUTLN (cerr, "G_random_element= " << G_random_element);
+      alpha= V_buf;
     }
 
@@ -2193,7 +2203,8 @@
   CFArray gcds= CFArray (biggestSize);
   CFList * pEvalPoints= new CFList [biggestSize];
-  Variable V_buf= alpha;
+  Variable V_buf= alpha, V_buf4= alpha;
   CFList source, dest;
   CanonicalForm prim_elem, im_prim_elem;
+  CanonicalForm prim_elem_alpha, im_prim_elem_alpha;
   for (int i= 0; i < biggestSize; i++)
   {
@@ -2213,11 +2224,14 @@
         do
         {
-          Variable V_buf2= chooseExtension (V_buf);
+          Variable V_buf3= V_buf;
+          V_buf= chooseExtension (V_buf);
           source= CFList();
           dest= CFList();
 
           bool prim_fail= false;
-          Variable V_buf3;
-          prim_elem= primitiveElement (V_buf, V_buf3, prim_fail);
+          Variable V_buf2;
+          prim_elem= primitiveElement (V_buf4, V_buf2, prim_fail);
+          if (V_buf4 == alpha && alpha.level() != 1)
+            prim_elem_alpha= prim_elem;
 
           ASSERT (!prim_fail, "failure in integer factorizer");
@@ -2225,18 +2239,24 @@
             ; //ERROR
           else
-            im_prim_elem= mapPrimElem (prim_elem, V_buf, V_buf2);
+            im_prim_elem= mapPrimElem (prim_elem, V_buf4, V_buf);
 
           DEBOUTLN (cerr, "getMipo (alpha)= " << getMipo (V_buf));
           DEBOUTLN (cerr, "getMipo (alpha)= " << getMipo (V_buf2));
 
+          if (V_buf4 == alpha && alpha.level() != 1)
+            im_prim_elem_alpha= im_prim_elem;
+          else if (alpha.level() != 1)
+            im_prim_elem_alpha= mapUp (im_prim_elem_alpha, V_buf4, V_buf,
+                                       prim_elem, im_prim_elem, source, dest);
+
           for (CFListIterator j= list; j.hasItem(); j++)
-            j.getItem()= mapUp (j.getItem(), V_buf, V_buf2, prim_elem,
+            j.getItem()= mapUp (j.getItem(), V_buf4, V_buf, prim_elem,
                                 im_prim_elem, source, dest);
           for (int k= 0; k < i; k++)
           {
             for (CFListIterator j= pEvalPoints[k]; j.hasItem(); j++)
-              j.getItem()= mapUp (j.getItem(), V_buf, V_buf2, prim_elem,
+              j.getItem()= mapUp (j.getItem(), V_buf4, V_buf, prim_elem,
                                   im_prim_elem, source, dest);
-            gcds[k]= mapUp (gcds[k], V_buf, V_buf2, prim_elem, im_prim_elem,
+            gcds[k]= mapUp (gcds[k], V_buf4, V_buf, prim_elem, im_prim_elem,
                             source, dest);
           }
@@ -2244,7 +2264,8 @@
           if (alpha.level() != 1)
           {
-            A= mapUp (A, V_buf, V_buf2, prim_elem, im_prim_elem, source,dest);
-            B= mapUp (B, V_buf, V_buf2, prim_elem, im_prim_elem, source,dest);
+            A= mapUp (A, V_buf4, V_buf, prim_elem, im_prim_elem, source,dest);
+            B= mapUp (B, V_buf4, V_buf, prim_elem, im_prim_elem, source,dest);
           }
+          V_buf4= V_buf;
           evalFail= false;
           evalPoints= evaluationPoints (A, B, Aeval, Beval, LCA, GF, V_buf,
@@ -2264,4 +2285,5 @@
           deg++;
         } while (evalFail);
+        V_buf4= V_buf;
       }
     }
@@ -2360,5 +2382,5 @@
   {
     CFList u, v;
-    result= mapDown (result, prim_elem, im_prim_elem, alpha, u, v);
+    result= mapDown (result, prim_elem_alpha, im_prim_elem_alpha, alpha, u, v);
   }
 
@@ -2465,7 +2487,8 @@
   CFArray gcds= CFArray (biggestSize);
   CFList * pEvalPoints= new CFList [biggestSize];
-  Variable V_buf= alpha;
+  Variable V_buf= alpha, V_buf4= alpha;
   CFList source, dest;
   CanonicalForm prim_elem, im_prim_elem;
+  CanonicalForm prim_elem_alpha, im_prim_elem_alpha;
   for (int i= 0; i < biggestSize; i++)
   {
@@ -2484,11 +2507,14 @@
           do
           {
-            Variable V_buf2= chooseExtension (V_buf);
+            Variable V_buf3= V_buf;
+            V_buf= chooseExtension (V_buf);
             source= CFList();
             dest= CFList();
 
             bool prim_fail= false;
-            Variable V_buf3;
-            prim_elem= primitiveElement (V_buf, V_buf3, prim_fail);
+            Variable V_buf2;
+            prim_elem= primitiveElement (V_buf4, V_buf2, prim_fail);
+            if (V_buf4 == alpha && alpha.level() != 1)
+              prim_elem_alpha= prim_elem;
 
             ASSERT (!prim_fail, "failure in integer factorizer");
@@ -2496,13 +2522,25 @@
               ; //ERROR
             else
-              im_prim_elem= mapPrimElem (prim_elem, V_buf, V_buf2);
-
-            DEBOUTLN (cerr, "getMipo (alpha)= " << getMipo (V_buf));
-            DEBOUTLN (cerr, "getMipo (alpha)= " << getMipo (V_buf2));
+              im_prim_elem= mapPrimElem (prim_elem, V_buf4, V_buf);
+
+            DEBOUTLN (cerr, "getMipo (V_buf)= " << getMipo (V_buf));
+            DEBOUTLN (cerr, "getMipo (V_buf2)= " << getMipo (V_buf2));
+
+            if (V_buf4 == alpha && alpha.level() != 1)
+              im_prim_elem_alpha= im_prim_elem;
+            else if (alpha.level() != 1)
+              im_prim_elem_alpha= mapUp (im_prim_elem_alpha, V_buf4, V_buf,
+                                         prim_elem, im_prim_elem, source, dest);
 
             for (CFListIterator i= list; i.hasItem(); i++)
-              i.getItem()= mapUp (i.getItem(), V_buf, V_buf2, prim_elem,
+              i.getItem()= mapUp (i.getItem(), V_buf4, V_buf, prim_elem,
                                 im_prim_elem, source, dest);
+            if (alpha.level() != 1)
+            {
+              A= mapUp (A, V_buf4, V_buf, prim_elem, im_prim_elem, source,dest);
+              B= mapUp (B, V_buf4, V_buf, prim_elem, im_prim_elem, source,dest);
+            }
             evalFail= false;
+            V_buf4= V_buf;
             evalPoints= evaluationPoints (A, B, Aeval, Beval, LCA, GF, V_buf,
                                           evalFail, list);
@@ -2521,4 +2559,5 @@
             deg++;
           } while (evalFail);
+          V_buf4= V_buf;
         }
       }
@@ -2821,4 +2860,16 @@
     for (int i= 0; i < skelSize; i++)
     {
+      if (coeffMonoms[i].size() + 1 >= pMat[i].rows() || coeffMonoms[i].size() + 1 >= pMat[i].columns())
+      {
+        delete[] pEvalPoints;
+        delete[] pMat;
+        delete[] pL;
+        delete[] coeffMonoms;
+        delete[] pM;
+        if (bufpEvalPoints != NULL)
+          delete [] bufpEvalPoints;
+        fail= true;
+        return 0;
+      }
       bufMat= pMat[i] (coeffMonoms[i].size() + 1, pMat[i].rows(),
                        coeffMonoms[i].size() + 1, pMat[i].columns());
@@ -2870,5 +2921,5 @@
     {
       CFList u, v;
-      result= mapDown (result, prim_elem, im_prim_elem, alpha, u, v);
+      result= mapDown (result,prim_elem_alpha, im_prim_elem_alpha, alpha, u, v);
     }
     result= N(result);
@@ -3044,6 +3095,7 @@
   topLevel= false;
   bool inextension= false;
-  Variable V_buf= alpha;
+  Variable V_buf= alpha, V_buf4= alpha;
   CanonicalForm prim_elem, im_prim_elem;
+  CanonicalForm prim_elem_alpha, im_prim_elem_alpha;
   CFList source, dest;
   do // first do
@@ -3065,18 +3117,20 @@
       bool prim_fail= false;
       Variable V_buf2;
-      prim_elem= primitiveElement (alpha, V_buf2, prim_fail);
-
-      if (V_buf3 != alpha)
-      {
-        m= mapDown (m, prim_elem, im_prim_elem, alpha, source, dest);
-        G_m= mapDown (m, prim_elem, im_prim_elem, alpha, source, dest);
-        newtonPoly= mapDown (newtonPoly, prim_elem, im_prim_elem, alpha,
+      prim_elem= primitiveElement (V_buf4, V_buf2, prim_fail);
+      if (V_buf4 == alpha)
+        prim_elem_alpha= prim_elem;
+
+      if (V_buf3 != V_buf4)
+      {
+        m= mapDown (m, prim_elem, im_prim_elem, V_buf4, source, dest);
+        G_m= mapDown (m, prim_elem, im_prim_elem, V_buf4, source, dest);
+        newtonPoly= mapDown (newtonPoly, prim_elem, im_prim_elem, V_buf4,
                              source, dest);
-        ppA= mapDown (ppA, prim_elem, im_prim_elem, alpha, source, dest);
-        ppB= mapDown (ppB, prim_elem, im_prim_elem, alpha, source, dest);
-        gcdlcAlcB= mapDown (gcdlcAlcB, prim_elem, im_prim_elem, alpha, source,
+        ppA= mapDown (ppA, prim_elem, im_prim_elem, V_buf4, source, dest);
+        ppB= mapDown (ppB, prim_elem, im_prim_elem, V_buf4, source, dest);
+        gcdlcAlcB= mapDown (gcdlcAlcB, prim_elem, im_prim_elem, V_buf4, source,
                             dest);
         for (CFListIterator i= l; i.hasItem(); i++)
-          i.getItem()= mapDown (i.getItem(), prim_elem, im_prim_elem, alpha,
+          i.getItem()= mapDown (i.getItem(), prim_elem, im_prim_elem, V_buf4,
                                 source, dest);
       }
@@ -3086,19 +3140,25 @@
         ; //ERROR
       else
-        im_prim_elem= mapPrimElem (prim_elem, alpha, V_buf);
-
-      DEBOUTLN (cerr, "getMipo (alpha)= " << getMipo (alpha));
+        im_prim_elem= mapPrimElem (prim_elem, V_buf4, V_buf);
+
+      if (V_buf4 == alpha)
+        im_prim_elem_alpha= im_prim_elem;
+      else
+        im_prim_elem_alpha= mapUp (im_prim_elem_alpha, V_buf4, V_buf, prim_elem,
+                                   im_prim_elem, source, dest);
+
+      DEBOUTLN (cerr, "getMipo (V_buf4)= " << getMipo (V_buf4));
       DEBOUTLN (cerr, "getMipo (V_buf2)= " << getMipo (V_buf2));
       inextension= true;
       for (CFListIterator i= l; i.hasItem(); i++)
-        i.getItem()= mapUp (i.getItem(), alpha, V_buf, prim_elem,
+        i.getItem()= mapUp (i.getItem(), V_buf4, V_buf, prim_elem,
                              im_prim_elem, source, dest);
-      m= mapUp (m, alpha, V_buf, prim_elem, im_prim_elem, source, dest);
-      G_m= mapUp (G_m, alpha, V_buf, prim_elem, im_prim_elem, source, dest);
-      newtonPoly= mapUp (newtonPoly, alpha, V_buf, prim_elem, im_prim_elem,
+      m= mapUp (m, V_buf4, V_buf, prim_elem, im_prim_elem, source, dest);
+      G_m= mapUp (G_m, V_buf4, V_buf, prim_elem, im_prim_elem, source, dest);
+      newtonPoly= mapUp (newtonPoly, V_buf4, V_buf, prim_elem, im_prim_elem,
                           source, dest);
-      ppA= mapUp (ppA, alpha, V_buf, prim_elem, im_prim_elem, source, dest);
-      ppB= mapUp (ppB, alpha, V_buf, prim_elem, im_prim_elem, source, dest);
-      gcdlcAlcB= mapUp (gcdlcAlcB, alpha, V_buf, prim_elem, im_prim_elem,
+      ppA= mapUp (ppA, V_buf4, V_buf, prim_elem, im_prim_elem, source, dest);
+      ppB= mapUp (ppB, V_buf4, V_buf, prim_elem, im_prim_elem, source, dest);
+      gcdlcAlcB= mapUp (gcdlcAlcB, V_buf4, V_buf, prim_elem, im_prim_elem,
                          source, dest);
 
@@ -3114,4 +3174,5 @@
                             "time for recursive call: ");
       DEBOUTLN (cerr, "G_random_element= " << G_random_element);
+      V_buf4= V_buf;
     }
     else
@@ -3174,5 +3235,5 @@
         {
           DEBOUTLN (cerr, "ppH before mapDown= " << ppH);
-          ppH= mapDown (ppH, prim_elem, im_prim_elem, alpha, u, v);
+          ppH= mapDown (ppH, prim_elem_alpha, im_prim_elem_alpha, alpha, u, v);
           ppH /= Lc(ppH);
           DEBOUTLN (cerr, "ppH after mapDown= " << ppH);
@@ -3211,18 +3272,20 @@
           bool prim_fail= false;
           Variable V_buf2;
-          prim_elem= primitiveElement (alpha, V_buf2, prim_fail);
-
-          if (V_buf3 != alpha)
+          prim_elem= primitiveElement (V_buf4, V_buf2, prim_fail);
+          if (V_buf4 == alpha)
+            prim_elem_alpha= prim_elem;
+
+          if (V_buf3 != V_buf4)
           {
-            m= mapDown (m, prim_elem, im_prim_elem, alpha, source, dest);
-            G_m= mapDown (m, prim_elem, im_prim_elem, alpha, source, dest);
-            newtonPoly= mapDown (newtonPoly, prim_elem, im_prim_elem, alpha,
+            m= mapDown (m, prim_elem, im_prim_elem, V_buf4, source, dest);
+            G_m= mapDown (m, prim_elem, im_prim_elem, V_buf4, source, dest);
+            newtonPoly= mapDown (newtonPoly, prim_elem, im_prim_elem, V_buf4,
                                  source, dest);
-            ppA= mapDown (ppA, prim_elem, im_prim_elem, alpha, source, dest);
-            ppB= mapDown (ppB, prim_elem, im_prim_elem, alpha, source, dest);
-            gcdlcAlcB= mapDown (gcdlcAlcB, prim_elem, im_prim_elem, alpha,
+            ppA= mapDown (ppA, prim_elem, im_prim_elem, V_buf4, source, dest);
+            ppB= mapDown (ppB, prim_elem, im_prim_elem, V_buf4, source, dest);
+            gcdlcAlcB= mapDown (gcdlcAlcB, prim_elem, im_prim_elem, V_buf4,
                                 source, dest);
             for (CFListIterator i= l; i.hasItem(); i++)
-              i.getItem()= mapDown (i.getItem(), prim_elem, im_prim_elem, alpha,
+              i.getItem()= mapDown (i.getItem(), prim_elem, im_prim_elem, V_buf4,
                                     source, dest);
           }
@@ -3232,20 +3295,26 @@
             ; //ERROR
           else
-            im_prim_elem= mapPrimElem (prim_elem, alpha, V_buf);
-
-          DEBOUTLN (cerr, "getMipo (alpha)= " << getMipo (alpha));
+            im_prim_elem= mapPrimElem (prim_elem, V_buf4, V_buf);
+
+          if (V_buf4 == alpha)
+            im_prim_elem_alpha= im_prim_elem;
+          else
+            im_prim_elem_alpha= mapUp (im_prim_elem_alpha, V_buf4, V_buf,
+                                       prim_elem, im_prim_elem, source, dest);
+
+          DEBOUTLN (cerr, "getMipo (V_buf4)= " << getMipo (V_buf4));
           DEBOUTLN (cerr, "getMipo (V_buf2)= " << getMipo (V_buf2));
           inextension= true;
           for (CFListIterator i= l; i.hasItem(); i++)
-            i.getItem()= mapUp (i.getItem(), alpha, V_buf, prim_elem,
+            i.getItem()= mapUp (i.getItem(), V_buf4, V_buf, prim_elem,
                                 im_prim_elem, source, dest);
-          m= mapUp (m, alpha, V_buf, prim_elem, im_prim_elem, source, dest);
-          G_m= mapUp (G_m, alpha, V_buf, prim_elem, im_prim_elem, source, dest);
-          newtonPoly= mapUp (newtonPoly, alpha, V_buf, prim_elem, im_prim_elem,
+          m= mapUp (m, V_buf4, V_buf, prim_elem, im_prim_elem, source, dest);
+          G_m= mapUp (G_m, V_buf4, V_buf, prim_elem, im_prim_elem, source, dest);
+          newtonPoly= mapUp (newtonPoly, V_buf4, V_buf, prim_elem, im_prim_elem,
                               source, dest);
-          ppA= mapUp (ppA, alpha, V_buf, prim_elem, im_prim_elem, source, dest);
-          ppB= mapUp (ppB, alpha, V_buf, prim_elem, im_prim_elem, source, dest);
-
-          gcdlcAlcB= mapUp (gcdlcAlcB, alpha, V_buf, prim_elem, im_prim_elem,
+          ppA= mapUp (ppA, V_buf4, V_buf, prim_elem, im_prim_elem, source, dest);
+          ppB= mapUp (ppB, V_buf4, V_buf, prim_elem, im_prim_elem, source, dest);
+
+          gcdlcAlcB= mapUp (gcdlcAlcB, V_buf4, V_buf, prim_elem, im_prim_elem,
                             source, dest);
 
@@ -3255,4 +3324,6 @@
           CFList list;
           TIMING_START (gcd_recursion);
+
+          V_buf4= V_buf;
 
           //sparseInterpolation
@@ -3347,5 +3418,5 @@
             {
               DEBOUTLN (cerr, "ppH before mapDown= " << ppH);
-              ppH= mapDown (ppH, prim_elem, im_prim_elem, alpha, u, v);
+              ppH= mapDown (ppH, prim_elem_alpha, im_prim_elem_alpha, alpha, u, v);
               ppH /= Lc(ppH);
               DEBOUTLN (cerr, "ppH after mapDown= " << ppH);
@@ -3569,4 +3640,5 @@
                             "time for recursive call: ");
       DEBOUTLN (cerr, "G_random_element= " << G_random_element);
+      alpha= V_buf;
     }
 
@@ -3650,10 +3722,10 @@
             G_random_element=
             monicSparseInterpol(ppA(random_element, x), ppB (random_element, x),
-                                skeleton, Variable(1), sparseFail, coeffMonoms,
+                                skeleton, x, sparseFail, coeffMonoms,
                                 Monoms);
           else
             G_random_element=
             nonMonicSparseInterpol(ppA(random_element,x), ppB(random_element,x),
-                                    skeleton, Variable (1), sparseFail,
+                                    skeleton, x, sparseFail,
                                     coeffMonoms, Monoms);
           TIMING_END_AND_PRINT (gcd_recursion,
@@ -3777,4 +3849,5 @@
                                 "time for recursive call: ");
           DEBOUTLN (cerr, "G_random_element= " << G_random_element);
+          alpha= V_buf;
         }
 
