Index: libpolys/polys/clapsing.cc
===================================================================
--- libpolys/polys/clapsing.cc	(revision adae8b2811aa80401958b914b4cfc7d0ad8eb36b)
+++ libpolys/polys/clapsing.cc	(revision 5a4e17def42b997c5643711c5553f5008753b451)
@@ -59,5 +59,5 @@
 void out_cf(const char *s1,const CanonicalForm &f,const char *s2);
 
-static poly singclap_gcd_r ( poly f, poly g, const ring r )
+poly singclap_gcd_r ( poly f, poly g, const ring r )
 {
   poly res=NULL;
@@ -66,12 +66,48 @@
   assume(g!=NULL);
 
-  if((pNext(f)==NULL) && (pNext(g)==NULL))
+  if(pNext(f)==NULL) 
   {
     poly p=p_One(r);
+    if (pNext(g)==NULL)
+    {
+      for(int i=rVar(r);i>0;i--)
+        p_SetExp(p,i,si_min(p_GetExp(f,i,r),p_GetExp(g,i,r)),r);
+      p_Setm(p,r);
+      return p;
+    }
+#if 0
+    else
+    {
+      poly h=g;
+      for(int i=rVar(r);i>0;i--)
+        p_SetExp(p,i,p_GetExp(f,i,r),r);
+      while(h!=NULL)
+      {
+        for(int i=rVar(r);i>0;i--)
+          p_SetExp(p,i,si_min(p_GetExp(p,i,r),p_GetExp(h,i,r)),r);
+	pIter(h);
+      }
+      p_Setm(p,r);
+      return p;
+    }
+#endif
+  }
+#if 0
+  else if (pNext(g)==NULL)
+  {
+    poly p=p_One(r);
+    poly h=f;
     for(int i=rVar(r);i>0;i--)
-      p_SetExp(p,i,si_min(p_GetExp(f,i,r),p_GetExp(g,i,r)),r);
+      p_SetExp(p,i,p_GetExp(g,i,r),r);
+    while(h!=NULL)
+    {
+      for(int i=rVar(r);i>0;i--)
+        p_SetExp(p,i,si_min(p_GetExp(p,i,r),p_GetExp(h,i,r)),r);
+      pIter(h);
+    }
     p_Setm(p,r);
     return p;
   }
+#endif
 
   Off(SW_RATIONAL);
Index: libpolys/polys/clapsing.h
===================================================================
--- libpolys/polys/clapsing.h	(revision adae8b2811aa80401958b914b4cfc7d0ad8eb36b)
+++ libpolys/polys/clapsing.h	(revision 5a4e17def42b997c5643711c5553f5008753b451)
@@ -29,4 +29,6 @@
 /// destroys f and g
 poly singclap_gcd ( poly f, poly g, const ring r );
+
+poly singclap_gcd_r ( poly f, poly g, const ring r );
 
 /// clears denominators of f and g, divides by gcd(f,g)
Index: libpolys/polys/ext_fields/transext.cc
===================================================================
--- libpolys/polys/ext_fields/transext.cc	(revision adae8b2811aa80401958b914b4cfc7d0ad8eb36b)
+++ libpolys/polys/ext_fields/transext.cc	(revision 5a4e17def42b997c5643711c5553f5008753b451)
@@ -1100,5 +1100,8 @@
 
   fraction f = (fraction)a;
-  if (DENIS1(f) || NUMIS1(f)) { COM(f) = 0; ntTest(a); return; }
+  if (COM(f)!=0) p_Normalize(NUM(f), ntRing);
+  if (DENIS1(f) || NUMIS1(f)) { COM(f) = 0; return; }
+
+  p_Normalize(DEN(f), ntRing);
 
   assume( DEN(f) != NULL );
@@ -1153,8 +1156,8 @@
 
   if (IS0(a)) return;
-  if (NUM(f)!=NULL) p_Normalize(NUM(f), ntRing);
-  if (DEN(f)!=NULL) p_Normalize(DEN(f), ntRing);
   if (!simpleTestsHaveAlreadyBeenPerformed)
   {
+    p_Normalize(NUM(f), ntRing);
+    if (DEN(f)!=NULL) p_Normalize(DEN(f), ntRing);
     if (DENIS1(f) || NUMIS1(f)) { COM(f) = 0; return; }
 
@@ -1169,14 +1172,65 @@
     }
   }
+  if (rField_is_Q(ntRing))
+  {
+    number c=n_Copy(pGetCoeff(NUM(f)),ntCoeffs);
+    poly p=pNext(NUM(f));
+    while((p!=NULL)&&(!n_IsOne(c,ntCoeffs)))
+    {
+      number cc=n_Gcd(c,pGetCoeff(p),ntCoeffs);
+      n_Delete(&c,ntCoeffs);
+      c=cc;
+      pIter(p);
+    };
+    p=DEN(f);
+    while((p!=NULL)&&(!n_IsOne(c,ntCoeffs)))
+    {
+      number cc=n_Gcd(c,pGetCoeff(p),ntCoeffs);
+      n_Delete(&c,ntCoeffs);
+      c=cc;
+      pIter(p);
+    };
+    if(!n_IsOne(c,ntCoeffs))
+    {
+      p=NUM(f);
+      do
+      {
+        number cc=n_Div(pGetCoeff(p),c,ntCoeffs);
+        n_Normalize(cc,ntCoeffs);
+        p_SetCoeff(p,cc,ntRing);
+        pIter(p);
+      } while(p!=NULL);
+      p=DEN(f);
+      do
+      {
+        number cc=n_Div(pGetCoeff(p),c,ntCoeffs);
+        n_Normalize(cc,ntCoeffs);
+        p_SetCoeff(p,cc,ntRing);
+        pIter(p);
+      } while(p!=NULL);
+      n_Delete(&c,ntCoeffs);
+      if(pNext(DEN(f))==NULL)
+      {
+        if (p_IsOne(DEN(f),ntRing))
+        {
+          p_LmDelete(&DEN(f),ntRing);
+          COM(f)=0;
+          return;
+        }
+        else
+        {
+          return;
+        }
+      }
+    }
+  }
 
 #ifdef HAVE_FACTORY
-  /* Note that, over Q, singclap_gcd will remove the denominators in all
-     rational coefficients of pNum and pDen, before starting to compute
-     the gcd. Thus, we do not need to ensure that the coefficients of
-     pNum and pDen live in Z; they may well be elements of Q\Z. */
-  /* singclap_gcd destroys its arguments; we hence need copies: */
-  poly pGcd = singclap_gcd(p_Copy(NUM(f), ntRing), p_Copy(DEN(f), ntRing), cf->extRing);
-  if (p_IsConstant(pGcd, ntRing) &&
-      n_IsOne(p_GetCoeff(pGcd, ntRing), ntCoeffs))
+  poly pGcd;
+  /* here we assume: NUM(f), DEN(f) !=NULL, in Z_a reqp. Z/p_a */
+    pGcd = singclap_gcd_r(NUM(f), DEN(f), ntRing);
+  if (p_IsConstant(pGcd, ntRing)
+  //&& n_IsOne(p_GetCoeff(pGcd, ntRing), ntCoeffs)
+  )
   { /* gcd = 1; nothing to cancel;
        Suppose the given rational function field is over Q. Although the
@@ -1350,5 +1404,5 @@
      the gcd. Thus, we do not need to ensure that the coefficients of
      pa and pb live in Z; they may well be elements of Q\Z. */
-  poly pGcd = singclap_gcd(pa, pb, cf->extRing);
+  poly pGcd = singclap_gcd(pa, pb, ntRing);
   if (p_IsConstant(pGcd, ntRing) &&
       n_IsOne(p_GetCoeff(pGcd, ntRing), ntCoeffs))
Index: libpolys/polys/monomials/p_polys.cc
===================================================================
--- libpolys/polys/monomials/p_polys.cc	(revision adae8b2811aa80401958b914b4cfc7d0ad8eb36b)
+++ libpolys/polys/monomials/p_polys.cc	(revision 5a4e17def42b997c5643711c5553f5008753b451)
@@ -1237,8 +1237,8 @@
 #ifdef HAVE_RINGS 
   if (rField_is_Ring(r))
-  	{
-  	if (p == NULL) return 0;
-  	if (!n_IsUnit(pGetCoeff(p), r->cf)) return 0;
-  	}
+          {
+          if (p == NULL) return 0;
+          if (!n_IsUnit(pGetCoeff(p), r->cf)) return 0;
+          }
 #endif
   int i,k=0;
@@ -2178,5 +2178,5 @@
         p=ph;
         while (p!=NULL)
-        { // each monom: coeff in Q_a
+        { // each monom: coeff in Q_a (Z_a)
           fraction f=(fraction)pGetCoeff(p);
           poly c_n=NUM(f);
@@ -2187,5 +2187,5 @@
           }
           while ((c_n!=NULL)&&(!n_IsOne(hzz,r->cf->extRing->cf)))
-          { // each monom: coeff in Q
+          { // each monom: coeff in Q (Z)
             d=n_Gcd(hzz,pGetCoeff(c_n),r->cf->extRing->cf);
             n_Delete(&hzz,r->cf->extRing->cf);
@@ -2203,5 +2203,5 @@
           p=ph;
           while (p!=NULL)
-          { // each monom: coeff in Q_a
+          { // each monom: coeff in Q_a (Z_a)
             fraction f=(fraction)pGetCoeff(p);
             NUM(f)=p_Mult_nn(NUM(f),h,r->cf->extRing);
@@ -2550,7 +2550,7 @@
       p_SetCoeff(p,n_Init(1,r->cf),r);
 
-    assume( n_GreaterZero(pGetCoeff(p),C) );
+    /*assume( n_GreaterZero(pGetCoeff(p),C) );
     if(!n_GreaterZero(pGetCoeff(p),C)) p = p_Neg(p,r);
-
+    */
     return p;
   }
@@ -2613,5 +2613,5 @@
       n_Delete(&h,r->cf);
     }
-    if (h!=NULL) n_Delete(&h,r->cf);
+    n_Delete(&h,r->cf);
     p=start;
 
@@ -2832,5 +2832,5 @@
     p_Content(ph,r);
     if(!n_GreaterZero(pGetCoeff(ph),C)) ph = p_Neg(ph,r);
-	assume( n_GreaterZero(pGetCoeff(ph),C) );
+        assume( n_GreaterZero(pGetCoeff(ph),C) );
     return;
   }
