Index: Tst/Short/bug_division_2.res.gz.uu
===================================================================
--- Tst/Short/bug_division_2.res.gz.uu	(revision 04929b7464b309106ba29576ca010079b1acdefc)
+++ Tst/Short/bug_division_2.res.gz.uu	(revision 04929b7464b309106ba29576ca010079b1acdefc)
@@ -0,0 +1,10 @@
+begin 640 bug_division_2.res.gz
+M'XL("+A#A%X"`V)U9U]D:79I<VEO;E\R+G)E<P"5D<V*PR`4A?=YBDN9A7:"
+M1-/.#T$70S>%QD6;KD()+2E%<%*(9MK'KZ:-R790\'"_<P]7W16KM00`*F"S
+M_H&9-99H=9IET>Y%F`!7K%2C+,)9Y$\0`D[=I:K5GS+JVE2,-.<;,?9H0ULJ
+M(.@%@58U%V@Y)#&ZX[@V8_Y2P._1MNH.><D.;O.2QHE?A]'T$4Q2>A=]NB:.
+M3^>XUIT^@^3&UDA*/,(O`5H9"YH/(Z,\GAJ^0W[!M4L/A":!;!UA$T(#V0,'
+M7:83Q@:&<CS?9U'EIG4STUZX*R9.,%]YBKXR]*:A5^)Y\?[26_R_E,7X_G1)
+4^B_T_],91''V%CT`UU]LD_@!````
+`
+end
Index: Tst/Short/bug_division_2.stat
===================================================================
--- Tst/Short/bug_division_2.stat	(revision 04929b7464b309106ba29576ca010079b1acdefc)
+++ Tst/Short/bug_division_2.stat	(revision 04929b7464b309106ba29576ca010079b1acdefc)
@@ -0,0 +1,4 @@
+1 >> tst_memory_0 :: 1585726392:4125, 64 bit:4.1.2:x86_64-Linux:nepomuck:86424
+1 >> tst_memory_1 :: 1585726392:4125, 64 bit:4.1.2:x86_64-Linux:nepomuck:2150192
+1 >> tst_memory_2 :: 1585726392:4125, 64 bit:4.1.2:x86_64-Linux:nepomuck:2191296
+1 >> tst_timer_1 :: 1585726392:4125, 64 bit:4.1.2:x86_64-Linux:nepomuck:4
Index: Tst/Short/bug_division_2.tst
===================================================================
--- Tst/Short/bug_division_2.tst	(revision 04929b7464b309106ba29576ca010079b1acdefc)
+++ Tst/Short/bug_division_2.tst	(revision 04929b7464b309106ba29576ca010079b1acdefc)
@@ -0,0 +1,15 @@
+LIB "tst.lib";
+tst_init();
+
+ring r= 0,(x),ds;
+matrix M[2][2]=[1,0,0,0];
+matrix NN[2][1]=[1,0];
+module N=std(NN);
+list l=division(M,N);
+matrix T=l[1];
+matrix R=l[2];
+matrix U = l[3];
+matrix(M)*U;
+matrix(N)*T+matrix(R);
+
+tst_status(1);$
Index: Tst/Short/div_lift_s.res.gz.uu
===================================================================
--- Tst/Short/div_lift_s.res.gz.uu	(revision eb91f7111038dfbf967fb4ff02b2f919c13e07d2)
+++ Tst/Short/div_lift_s.res.gz.uu	(revision 04929b7464b309106ba29576ca010079b1acdefc)
@@ -1,34 +1,34 @@
 begin 640 div_lift_s.res.gz
-M'XL("-UC15@``V1I=E]L:69T7W,N<F5S`.5966_C-A!^]Z\@C#Y8,6V+I,X&
-M<9&B#PX0]&7KIR#09F-E2]>Q%[;2*O[U'>H84I24`[MITVT.4/HX,YR+G\GD
-MPV^_7/Q*"&%S<GGQ,QEFAVRZD9^&IX,/U0R?$P`3N979R#D=J)',YV0E_TPV
-M\BY+#M-M^M?TD-UDJ"+F9#;#-V\*;R1+#QDYW.[EEXS<[?9$Z<[`B#S(W9;<
-M[N[O;[8KU/&GIH5@2O9R^YGLM5?AG,A5>K,A\BSG])'3(]>3$4[*L_N;O'@>
-M<4<+Q+7`&N?)2&@!YL[)4$(2)"*0H"_@1#:ZO\GV,A])!\3KI5$*DC5<@]X:
-M$6'IK97>4=#'H](]TD=!<WC,'X_P"R-`.7^DN4`+WIR4NF2I'?1A(97"D:1K
-M!Q;$9Y0(ZH5Q"A:&V'\B?+LB][O5PR8EJUUZ(-M=!N5(B=R2[/>4W,G](2LE
-MT_T>2K6[O7W8[].5$H#73RG4+R7E.ANY36&M'\G'UF(?T970<)8N37?A#:4B
-MVV&8?#N7HY;+Q7+::>B1X1)<7=8(=VL'E^"62]O?_V608)C0Z<-Z8];MU7A'
-M2>CVC81M?7F&\VLJ]3;BV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Q5L?R?)8ND1'FR
+M9)$LB<D*F4E6YUVYX[;<<5_NN#%WW)D[;LT=]^:.FW/'W;G]]MR5+'.M#GGQ
+73RC]7Z:O!SC^7_YPV?L;QP#LEKL:````
 `
 end
Index: Tst/Short/div_lift_s.stat
===================================================================
--- Tst/Short/div_lift_s.stat	(revision eb91f7111038dfbf967fb4ff02b2f919c13e07d2)
+++ Tst/Short/div_lift_s.stat	(revision 04929b7464b309106ba29576ca010079b1acdefc)
@@ -1,4 +1,4 @@
-1 >> tst_memory_0 :: 1480942444:4100, 64 bit:4.1.0:x86_64-Linux:nepomuck:242224
-1 >> tst_memory_1 :: 1480942444:4100, 64 bit:4.1.0:x86_64-Linux:nepomuck:2359296
-1 >> tst_memory_2 :: 1480942444:4100, 64 bit:4.1.0:x86_64-Linux:nepomuck:2383872
-1 >> tst_timer_1 :: 1480942444:4100, 64 bit:4.1.0:x86_64-Linux:nepomuck:1
+1 >> tst_memory_0 :: 1585666850:4125, 64 bit:4.1.2:x86_64-Linux:nepomuck:223416
+1 >> tst_memory_1 :: 1585666850:4125, 64 bit:4.1.2:x86_64-Linux:nepomuck:2310144
+1 >> tst_memory_2 :: 1585666850:4125, 64 bit:4.1.2:x86_64-Linux:nepomuck:2319312
+1 >> tst_timer_1 :: 1585666850:4125, 64 bit:4.1.2:x86_64-Linux:nepomuck:4
Index: Tst/Short/ok_s.lst
===================================================================
--- Tst/Short/ok_s.lst	(revision eb91f7111038dfbf967fb4ff02b2f919c13e07d2)
+++ Tst/Short/ok_s.lst	(revision 04929b7464b309106ba29576ca010079b1acdefc)
@@ -5,4 +5,5 @@
 bug_content
 bug_curvepar
+bug_division_2
 bug_ecart
 bug_mem_Z
Index: kernel/ideals.cc
===================================================================
--- kernel/ideals.cc	(revision eb91f7111038dfbf967fb4ff02b2f919c13e07d2)
+++ kernel/ideals.cc	(revision 04929b7464b309106ba29576ca010079b1acdefc)
@@ -1110,11 +1110,11 @@
 }
 
-static void idLift_setUnit(int e_mod, int e_smod,matrix *unit)
+static void idLift_setUnit(int e_mod, matrix *unit)
 {
   if (unit!=NULL)
   {
-    *unit=mpNew(e_mod,e_smod);
+    *unit=mpNew(e_mod,e_mod);
     // make sure that U is a diagonal matrix of units
-    for(int i=e_smod;i>0;i--)
+    for(int i=e_mod;i>0;i--)
     {
       MATELEM(*unit,i,i)=pOne();
@@ -1142,5 +1142,5 @@
       *rest=idInit(1,mod->rank);
     }
-    idLift_setUnit(idelems_mod,idelems_submod,unit);
+    idLift_setUnit(idelems_submod,unit);
     return idInit(1,idelems_mod);
   }
@@ -1150,5 +1150,5 @@
     {
       *rest=idCopy(submod);
-      idLift_setUnit(idelems_mod,idelems_submod,unit);
+      idLift_setUnit(idelems_submod,unit);
       return idInit(1,idelems_mod);
     }
@@ -1260,5 +1260,5 @@
           if (unit!=NULL)
           {
-            *unit=mpNew(comps_to_add,comps_to_add);
+            idLift_setUnit(idelems_submod,unit);
           }
           if (rest!=NULL) *rest=idCopy(submod);
@@ -1306,5 +1306,5 @@
   if (unit!=NULL)
   {
-    *unit=mpNew(comps_to_add,comps_to_add);
+    *unit=mpNew(idelems_submod,idelems_submod);
     int i;
     for(i=0;i<IDELEMS(s_result);i++)
