Index: Singular/ipshell.cc
===================================================================
--- Singular/ipshell.cc	(revision 69ad7eed9ae02d904a01c114ac5b581e8cd9483e)
+++ Singular/ipshell.cc	(revision f16c61cbb635c326db5e37a9292edf4969b843a2)
@@ -1659,5 +1659,5 @@
   {
     const ring RR = R->cf->extRing;
-    
+
     L->m[3].data=(void *) idCopy(RR->minideal, RR);
 //    I->m[0] = pNSet(R->minpoly);
@@ -2076,4 +2076,5 @@
   )
     return NULL;
+  int is_gf_char=0;
   // 0: char/ cf - ring
   // 1: list (var)
@@ -2083,10 +2084,10 @@
   // 4: C
   // 5: D
-  
-  ring R = (ring) omAlloc0Bin(sip_sring_bin); // why 
-   
-   
-  assume( R->cf == NULL );
-  
+
+  ring R = (ring) omAlloc0Bin(sip_sring_bin); // why
+
+
+  //assume( R->cf == NULL );
+
   // ------------------------------------------------------------------
   // 0: char:
@@ -2105,6 +2106,6 @@
         Warn("%d is invalid characteristic of ground field. %d is used.", ch, l);
         ch = l;
-      }      
-      R->cf = nInitChar(n_Zp, (void*)ch);       
+      }
+      R->cf = nInitChar(n_Zp, (void*)ch);
     }
   }
@@ -2112,5 +2113,5 @@
   {
     lists LL=(lists)L->m[0].Data();
-    
+
 #ifdef HAVE_RINGS
     if (LL->m[0].Typ() == STRING_CMD) // 1st comes a string?
@@ -2123,14 +2124,16 @@
       rComposeC(LL,R); // R, long_R, long_C
     else
-    {      
+    {
       if (LL->m[0].Typ()==INT_CMD)
-      {        
+      {
         int ch = (int)(long)LL->m[0].Data();
-
-        if(( ch != 0 ) && (ch!=IsPrime(ch))) // TODO: GF-Test ch!
+        while ((ch!=fftable[is_gf_char]) && (fftable[is_gf_char])) is_gf_char++;
+        if (fftable[is_gf_char]==0) is_gf_char=-1;
+
+        if(is_gf_char!= -1)
         {
           GFInfo param;
-        
-          param.GFChar = ch; 
+
+          param.GFChar = ch;
           param.GFDegree = 1;
           param.GFPar_name = (const char*)(((lists)(LL->m[1].Data()))->m[0].Data());
@@ -2144,5 +2147,5 @@
       {
         ring extRing = rCompose((lists)L->m[0].Data());
-        
+
         if (extRing==NULL)
         {
@@ -2154,5 +2157,5 @@
         {
           AlgExtInfo extParam;
-          
+
           extParam.i = extRing->qideal;
           extParam.r = extRing;
@@ -2160,6 +2163,7 @@
           extRing->qideal = NULL; // ???
 
-          R->cf = nInitChar(n_algExt, (void*)&extParam); 
-        } else // Transcendental extension
+          R->cf = nInitChar(n_algExt, (void*)&extParam);
+        }
+        else // Transcendental extension
         {
           TransExtInfo extParam;
@@ -2168,6 +2172,5 @@
           R->cf = nInitChar(n_transExt, &extParam);
         }
-        
-      }     
+      }
     }
   }
@@ -2386,5 +2389,5 @@
   rComplete(R);
 
-#ifdef HAVE_RINGS 
+#ifdef HAVE_RINGS
   // This was a BUG IN SINGULAR: There is no HABE_RINGS!!!
 
@@ -2437,9 +2440,9 @@
             par_perm_size=rPar(orig_ring);
             BITSET save_test=test;
-            
+
 //            if ((orig_ring->minpoly != NULL) || (orig_ring->minideal != NULL))
 //              naSetChar(rInternalChar(orig_ring),orig_ring);
 //            else ntSetChar(rInternalChar(orig_ring),orig_ring);
-            
+
             nSetChar(currRing->cf);
             test=save_test;
@@ -2822,5 +2825,5 @@
   Werror("Sorry: not yet re-factored: see libpolys/polys/clapsing.cc");
   return FALSE;
-#else   
+#else
   res->data=singclap_irrCharSeries((ideal)u->Data(), currRing);
   return (res->data==NULL);
@@ -4947,5 +4950,5 @@
   // get ch of ground field
   int numberOfAllocatedBlocks;
-  
+
   // allocated ring
   R = (ring) omAlloc0Bin(sip_sring_bin);
@@ -4955,12 +4958,12 @@
   assume( pn != NULL );
   const int P = pn->listLength();
-  
+
   if (pn->Typ()==INT_CMD)
   {
     int ch = (int)(long)pn->Data();
-    
+
     /* parameter? -------------------------------------------------------*/
     pn = pn->next;
-    
+
     if (pn == NULL) // no params!?
     {
@@ -4983,10 +4986,10 @@
       {
         GFInfo param;
-	 
-        param.GFChar = ch; 
-        param.GFDegree = 1;	 
+
+        param.GFChar = ch;
+        param.GFDegree = 1;
         param.GFPar_name = pn->name;
-        
-        cf = nInitChar(n_GF, &param);        
+
+        cf = nInitChar(n_GF, &param);
       }
       else // (0/p, a, b, ..., z)
@@ -4999,5 +5002,5 @@
 //           goto rInitError;
 //         }
-        
+
         char ** names = (char**)omAlloc0(pars * sizeof(char_ptr));
 
@@ -5009,11 +5012,11 @@
 
         TransExtInfo extParam;
-        
+
         extParam.r = rDefault( ch, pars, names); // Q/Zp [ p_1, ... p_pars ]
-        
+
         cf = nInitChar(n_transExt, &extParam);
       }
     }
-    
+
 //    if (cf==NULL) goto rInitError;
     assume( cf != NULL );
@@ -5070,5 +5073,5 @@
     else
       cf=nInitChar(n_Z,NULL);
-    
+
     if ((mpz_cmp_ui(modBase, 1) == 0) && (mpz_cmp_ui(modBase, 0) < 0))
     {
@@ -5121,5 +5124,5 @@
     extParam.r = (ring)pn->Data();
     extParam.i = (extParam.r->qideal);
-    
+
     cf = nInitChar(n_algExt, &extParam);   // Q[a]/<minideal>
   }
@@ -5135,5 +5138,5 @@
       p = p->next;
     }
-#endif    
+#endif
     goto rInitError;
   }
@@ -5164,7 +5167,7 @@
 
   assume( R != NULL );
-  
+
   R->cf = cf;
-  
+
 #ifdef HAVE_RINGS
   // the following should have beed set already into cf, right?!
