Index: Singular/LIB/primitiv.lib
===================================================================
--- Singular/LIB/primitiv.lib	(revision 604d8bb038d7aa985d50d55053096e60b087e614)
+++ Singular/LIB/primitiv.lib	(revision b41ecb2f02b86cc0b679c2ecb470330dae622a51)
@@ -165,14 +165,18 @@
 {
  def altring=basering;
- int grad1,grad2=deg(i[1]),deg(jet(i[2],0,intvec(1,0)));
+ int grad1=deg(i[1]);
+ int grad2=deg(jet(i[2],0,intvec(1,0)));
+ if (grad2==0) { ERROR("i[2] is not monic"); }
  int countx,countz;
+  if (size(variables(i[1]))!=1) { ERROR("i[1] must be poly in x"); }
+  if (size(variables(i[2]))!=2) { ERROR("i[2] must be poly in x,a"); }
+  if (variables(i[2])[2]!=a) { ERROR("i[2] must be poly in x,a"); }
  ring deglexring=char(altring),(x,y,z),dp;
  map transfer=altring,x,z;
  ideal i=transfer(i);
- if (size(i)!=2) {
-   "//** Error -- either wrong number of given minimal polynomials";
-   "//**          or wrong choice of ring variables (must use the first two)";
-   setring altring;
-   return(ideal(0));
+ if (size(i)!=2)
+ {
+   ERROR("either wrong number of given minimal polynomials"+newline+
+   "or wrong choice of ring variables (must use the first two)");
  }
  matrix mat;
@@ -189,5 +193,6 @@
  //---------------- Schleife zum Finden des primitiven Elements ---------------
  //--- Schleife ist so angordnet, dass g in Charakteristik 0 linear bleibt ----
- while (found==0) {
+ while (found==0)
+ {
    j=eliminate(i+ideal(g-y),z);
    setring deglex2ring;
@@ -195,8 +200,11 @@
    setring lexring;
    j=fglm(deglex2ring,j);
-   if (size(j)==2) {
-     if (deg(j[1])==grad1*grad2) {
+   if (size(j)==2)
+   {
+     if (deg(j[1])==grad1*grad2)
+     {
        j[2]=j[2]/leadcoef(j[2]);    // Normierung
-       if (lead(j[2])==x) {         // Alles ok
+       if (lead(j[2])==x)
+       {         // Alles ok
           found=1;
        }
@@ -204,26 +212,29 @@
    }
    setring deglexring;
-   if (found==0) {
+   if (found==0)
+   {
  //------------------ waehle ein neues Polynom g ------------------------------
      dbprint("Still searching for primitive element...");
      countx=0;
      countz=0;
-     while (found==0) {
+     while (found==0)
+     {
       countx++;
-      if (countx>=grad1) {
+      if (countx>=grad1)
+      {
         countx=0;
         countz++;
-        if (countz>=grad2) {
-         "//** Error: No primitive element found!! This should NEVER happen!";
-         setring altring;
-         return(ideal(0));
-        }
+        if (countz>=grad2)
+	{ ERROR("No primitive element found!! This should NEVER happen!"); }
       }
       g = g +x^countx *z^countz;
       mat=coeffs(g,z);
-      if (size(mat)>countz) {
+      if (size(mat)>countz)
+      {
         mat=coeffs(mat[countz+1,1],x);
-        if (size(mat)>countx) {
-          if (mat[countx+1,1] != 0) {
+        if (size(mat)>countx)
+	{
+          if (mat[countx+1,1] != 0)
+	  {
             found=1;         // d.h. hier: neues g gefunden
       }}}
Index: Singular/LIB/zeroset.lib
===================================================================
--- Singular/LIB/zeroset.lib	(revision 604d8bb038d7aa985d50d55053096e60b087e614)
+++ Singular/LIB/zeroset.lib	(revision b41ecb2f02b86cc0b679c2ecb470330dae622a51)
@@ -98,4 +98,7 @@
   int dbPrt = printlevel-voice+3;
 
+  ideal fff=sqrfree(f);
+  f=fff[1];
+  for(int iii=2;iii<ncols(fff);iii++) { f=f*fff[iii]; }
   // create a new ring where par(1) is replaced by the variable
   // with the same name or, if basering does not contain a parameter,
@@ -225,6 +228,6 @@
   Xchange[2] = var(1);      // for the use of 'primitive'
 
-  if(nlinFactors == 1) {            // one nl factor
-
+  if(nlinFactors == 1)             // one nl factor
+  {
     // compute the roots of the nonlinear (irreducible, monic) factor f1 of f
     // by extending the basefield by a' with minimal polynomial f1
@@ -232,8 +235,12 @@
 
     f1 = nlFactors[1];
-    if(mpoly[1] != 0) {
+    if(mpoly[1] != 0)
+    {
       mp = mpoly[1];
       minPolys = Xchange(mp), Xchange(f1);
-      primElem = primitive_extra(minPolys);  // no random coord. change
+      if (deg(jet(minPolys[2],0,intvec(1,0)))==0)
+      { primElem = primitive(minPolys); } // random coord. change
+      else
+      { primElem = primitive_extra(minPolys); } // no random coord. change
       mpoly = std(primElem[1]);
       F = basering, maxideal(1);
