Index: coeffs/coeffs.h
===================================================================
--- coeffs/coeffs.h	(revision 63c3a8df898418cfb9484633a8d9eb78c299a95c)
+++ coeffs/coeffs.h	(revision 8c484ed8f3ff767d800560901766fe5a4d8eccda)
@@ -128,5 +128,5 @@
    // ?
    // initialisation:
-   void (*cfInitChar)(coeffs r); // do one-time initialisations
+   void (*cfInitChar)(coeffs r, int parameter); // do one-time initialisations
    void (*cfKillChar)(coeffs r); //  undo all initialisations
                                 // or NULL
Index: coeffs/modulop.cc
===================================================================
--- coeffs/modulop.cc	(revision 63c3a8df898418cfb9484633a8d9eb78c299a95c)
+++ coeffs/modulop.cc	(revision 8c484ed8f3ff767d800560901766fe5a4d8eccda)
@@ -8,12 +8,15 @@
 
 #include <string.h>
+#include "config.h"
+#include <omalloc.h>
 #include "coeffs.h"
+#include "output.h"
 #include "numbers.h"
 #include "longrat.h"
 #include "mpr_complex.h"
+#include "mylimits.h"
 #include "modulop.h"
 
 int npGen=0;
-long npMapPrime;
 
 #ifdef HAVE_DIV_MOD
@@ -243,5 +246,5 @@
       ii *= 10;
       ii += *s++ - '0';
-      if (ii >= (MAX_INT_VAL / 10)) ii = ii % r->npPrimeM;
+      if (ii >= (MAX_INT / 10)) ii = ii % r->npPrimeM;
     }
     while (((*s) >= '0') && ((*s) <= '9'));
@@ -304,5 +307,21 @@
 }
 
-void npInitChar(int c, coeffs r)
+void npKillChar(coeffs r)
+{
+  #ifdef HAVE_DIV_MOD
+  if (r->npInvTable!=NULL)
+  omFreeSize( (void *)r->npInvTable, r->npPrimeM*sizeof(unsigned short) );
+  r->npInvTable=NULL;
+  #else
+  if (r->npExpTable!=NULL)
+  {
+    omFreeSize( (void *)r->npExpTable, r->npPrimeM*sizeof(unsigned short) );
+    omFreeSize( (void *)r->npLogTable, r->npPrimeM*sizeof(unsigned short) );
+    r->npExpTable=NULL; r->npLogTable=NULL;
+  }
+  #endif
+}
+
+void npInitChar(coeffs r, int c)
 {
   int i, w;
@@ -353,4 +372,41 @@
 #endif
     }
+    r->cfKillChar=npKillChar;
+    r->cfSetChar=NULL;
+    r->cfInit = npInit;
+    r->n_Int  = npInt;
+    r->nAdd   = npAdd;
+    r->nSub   = npSub;
+    r->nMult  = npMult;
+    r->nDiv   = npDiv;
+    r->nExactDiv= npDiv;
+    r->nNeg   = npNeg;
+    r->nInvers= npInvers;
+    r->cfCopy  = ndCopy;
+    r->nGreater = npGreater;
+    r->nEqual = npEqual;
+    r->nIsZero = npIsZero;
+    r->nIsOne = npIsOne;
+    r->nIsMOne = npIsMOne;
+    r->nGreaterZero = npGreaterZero;
+    r->cfWrite = npWrite;
+    r->nRead = npRead;
+    r->nPower = npPower;
+    r->cfSetMap = npSetMap;
+    r->nName= ndName; 
+    r->nSize  = ndSize;
+#ifdef LDEBUG
+    r->nDBTest=npDBTest;
+#endif
+#ifdef NV_OPS
+    if (c>NV_MAX_PRIME)
+    {
+      r->nMult  = nvMult;
+      r->nDiv   = nvDiv;
+      r->nExactDiv= nvDiv;
+      r->nInvers= nvInvers;
+      r->nPower= nvPower;
+    }
+#endif
   }
   else
@@ -372,15 +428,15 @@
 #endif
 
-number npMap0(number from, const coeffs dst_r)
+number npMap0(number from, const coeffs src, const coeffs dst_r)
 {
   return npInit(nlModP(from,dst_r->npPrimeM),dst_r);
 }
 
-number npMapP(number from, const coeffs dst_r)
+number npMapP(number from, const coeffs src, const coeffs dst_r)
 {
   long i = (long)from;
-  if (i>npMapPrime/2)
-  {
-    i-=npMapPrime;
+  if (i>src->npPrimeM/2)
+  {
+    i-=src->npPrimeM;
     while (i < 0) i+=dst_r->npPrimeM;
   }
@@ -389,5 +445,5 @@
 }
 
-static number npMapLongR(number from, const coeffs dst_r)
+static number npMapLongR(number from, const coeffs src, const coeffs dst_r)
 {
   gmp_float *ff=(gmp_float*)from;
@@ -455,5 +511,5 @@
   mpz_clear(dest);
   if(res->s==0)
-    iz=(long)npDiv((number)iz,(number)in);
+    iz=(long)npDiv((number)iz,(number)in,dst_r);
   omFreeBin((void *)res, rnumber_bin);
   return (number)iz;
@@ -507,9 +563,8 @@
     if (n_GetChar(src) == n_GetChar(dst))
     {
-      return ndCopy;
+      return ndCopyMap;
     }
     else
     {
-      npMapPrime=n_GetChar(src);
       return npMapP;
     }
Index: coeffs/modulop.h
===================================================================
--- coeffs/modulop.h	(revision 63c3a8df898418cfb9484633a8d9eb78c299a95c)
+++ coeffs/modulop.h	(revision 8c484ed8f3ff767d800560901766fe5a4d8eccda)
@@ -24,4 +24,6 @@
 extern int npGen;
 extern long npMapPrime;
+
+void npInitChar(coeffs r, int ch);
 
 BOOLEAN npGreaterZero (number k, const coeffs r);
Index: coeffs/numbers.cc
===================================================================
--- coeffs/numbers.cc	(revision 63c3a8df898418cfb9484633a8d9eb78c299a95c)
+++ coeffs/numbers.cc	(revision 8c484ed8f3ff767d800560901766fe5a4d8eccda)
@@ -396,4 +396,5 @@
   /*----------------------char. p----------------*/
   {
+    /* never again:
     npInitChar(c,r);
     n->cfInit = npInit;
@@ -417,6 +418,6 @@
     n->nPower = npPower;
     n->cfSetMap = npSetMap;
-    /* nName= ndName; */
-    /*nSize  = ndSize;*/
+    // nName= ndName;
+    // nSize  = ndSize;
 #ifdef LDEBUG
     n->nDBTest=npDBTest;
@@ -433,4 +434,7 @@
     }
 #endif
+    */
+    r->cfInitChar=npInitChar;
+    npInitChar(r,c);
   }
   /* -------------- GF(p^m) -----------------------*/
@@ -594,21 +598,8 @@
         if (cf_root==r) cf_root=n->next;
         r->cfDelete(&(r->nNULL),r);
+	if (r->cfKillChar!=NULL) r->cfKillChar(r);
+	/* was:
         switch(r->type)
         {
-          case n_Zp:
-               #ifdef HAVE_DIV_MOD
-               if (r->npInvTable!=NULL)
-               omFreeSize( (void *)r->npInvTable,
-                           r->npPrimeM*sizeof(unsigned short) );
-               #else
-               if (r->npExpTable!=NULL)
-               {
-                 omFreeSize( (void *)r->npExpTable,
-                             r->npPrimeM*sizeof(unsigned short) );
-                 omFreeSize( (void *)r->npLogTable,
-                             r->npPrimeM*sizeof(unsigned short) );
-               }
-               #endif
-               break;
           case n_Zp_a:
           case n_Q_a:
@@ -626,4 +617,5 @@
                  break;
           }
+	  */
           omFreeSize((void *)r, sizeof(n_Procs_s));
           r=NULL;
Index: coeffs/numbers.h
===================================================================
--- coeffs/numbers.h	(revision 63c3a8df898418cfb9484633a8d9eb78c299a95c)
+++ coeffs/numbers.h	(revision 8c484ed8f3ff767d800560901766fe5a4d8eccda)
@@ -66,4 +66,6 @@
 number ndCopy(number a, const coeffs r);
 number ndCopyMap(number a, const coeffs r, const coeffs aRing);
+int ndSize(number a, const coeffs r);
+char * ndName(number n, const coeffs r);
 
 void   ndInpMult(number &a, number b, const coeffs r);
