Index: Singular/dyn_modules/customstd/customstd.cc
===================================================================
--- Singular/dyn_modules/customstd/customstd.cc	(revision 58399e5955b89ce4f0005174693ea0831df58d45)
+++ Singular/dyn_modules/customstd/customstd.cc	(revision a0e02588881623134f70bb2c9041a27f6cbab5c4)
@@ -49,14 +49,4 @@
   {
     poly p=strat->P.p;
-    if (pNext(p)==NULL)
-    {
-      // if a term is contained in the ideal, abort std computation
-      // and store the whole ring in idealCache to be returned
-      while ((strat->Ll >= 0))
-        deleteInL(strat->L,&strat->Ll,strat->Ll,strat);
-      idealCache = idInit(1);
-      idealCache->m[0] = p_One(currRing);
-      return FALSE;
-    }
 
     // iterate over all terms of p and
@@ -65,5 +55,5 @@
     int *m0=(int*)omAlloc((1+rVar(currRing))*sizeof(int));
     p_GetExpV(p,mm,currRing);
-    bool nonTrivialSaturationToBeDone=false;
+    bool nonTrivialSaturationToBeDone=true;
     for (p=pNext(p); p!=NULL; pIter(p))
     {
@@ -83,8 +73,10 @@
       // std::cout << "simplifying!" << std::endl;
       p=p_Copy(strat->P.p,currRing);
+      memset(&strat->P,0,sizeof(strat->P));
+      strat->P.tailRing = strat->tailRing;
       strat->P.p=p;
       while(p!=NULL)
       {
-        for (int i=1; i<satstdSaturatingVariables.size(); i++)
+        for (int i=0; i<satstdSaturatingVariables.size(); i++)
         {
           int li = satstdSaturatingVariables[i];
@@ -102,14 +94,4 @@
   {
     poly p=strat->P.t_p;
-    if (pNext(p)==NULL)
-    {
-      // if a term is contained in the ideal, abort std computation
-      // and store the output in idealCache to be returned
-      while ((strat->Ll >= 0))
-        deleteInL(strat->L,&strat->Ll,strat->Ll,strat);
-      idealCache = idInit(1);
-      idealCache->m[0] = p_One(currRing);
-      return FALSE;
-    }
 
     // iterate over all terms of p and
@@ -118,5 +100,5 @@
     int *m0=(int*)omAlloc((1+rVar(currRing))*sizeof(int));
     p_GetExpV(p,mm,strat->tailRing);
-    bool nonTrivialSaturationToBeDone=false;
+    bool nonTrivialSaturationToBeDone=true;
     for (p = pNext(p); p!=NULL; pIter(p))
     {
@@ -135,10 +117,14 @@
     {
       p=p_Copy(strat->P.t_p,strat->tailRing);
+      memset(&strat->P,0,sizeof(strat->P));
+      strat->P.tailRing = strat->tailRing;
       strat->P.t_p=p;
-      strat->P.p=NULL;
       while(p!=NULL)
       {
-        for(int i=1;i<=rVar(currRing);i++)
-          p_SubExp(p,i,mm[i],strat->tailRing);
+        for(int i=0; i<satstdSaturatingVariables.size(); i++)
+        {
+          int li = satstdSaturatingVariables[i];
+          p_SubExp(p,li,mm[li],strat->tailRing);
+        }
         p_Setm(p,strat->tailRing);
         pIter(p);
@@ -174,74 +160,11 @@
 
   // check that remaining variables have zero exponent
-  for (i++; i<=rVar(r); i++)
+  for (l=i+1; l<=rVar(r); l++)
   {
-    if (p_GetExp(x,i,r)>0)
+    if (p_GetExp(x,l,r)>0)
       return 0;
   }
 
-  return l;
-}
-
-//------------------------------------------------------------------------
-// routine that simplifies the ideal dividing each generator by the maximal monomial dividing it
-// in particular returns 1 if a generator is a term
-// to be used before starting saturation with respect to all variables
-static void satSimplify(ideal I, const ring r)
-{
-  idSkipZeroes(I);
-  int k = IDELEMS(I);
-  int *mm=(int*)omAlloc((1+rVar(r))*sizeof(int));
-  int *m0=(int*)omAlloc((1+rVar(r))*sizeof(int));
-  for (int i=0; i<k; i++)
-  {
-    poly p = I->m[i];
-    if (p != NULL)
-    {
-      // check whether p is a term, return 1 if true
-      if (p->next == NULL)
-      {
-        p_Delete(&I->m[0],r);
-        I->m[0] = p_One(r);
-        for (int j=1; j<k; j++)
-        {
-          p_Delete(&I->m[j],r);
-          I->m[j] = NULL;
-        }
-        idSkipZeroes(I);
-        omFree(mm);
-        omFree(m0);
-        return;
-      }
-
-      // check whether p is divisible by a monomial
-      // divide if true
-      p_GetExpV(p,mm,r);
-      bool satNecessary=false;
-      for (; p!=NULL; pIter(p))
-      {
-        satNecessary=false;
-        p_GetExpV(p,m0,r);
-        for(int i=1;i<=rVar(r);i++)
-        {
-          mm[i]=si_min(mm[i],m0[i]);
-          if (mm[i]>0)
-            satNecessary=true;
-        }
-        if (satNecessary==false)
-          break;
-      }
-      if (satNecessary==true)
-      {
-        for (p=I->m[i]; p!=NULL; pIter(p))
-        {
-          for (int i=1; i<=rVar(r); i++)
-            p_SubExp(p,i,mm[i],r);
-          p_Setm(p,r);
-        }
-      }
-    }
-  }
-  omFree(mm);
-  omFree(m0);
+  return i;
 }
 
@@ -289,5 +212,4 @@
 
     ideal I = (ideal) u->Data();
-    satSimplify(I,currRing);
 
     idealCache = NULL;
