Index: Singular/ipshell.cc
===================================================================
--- Singular/ipshell.cc	(revision 7fcc5b108e080c630a6e6190bdcccc10fca68ccd)
+++ Singular/ipshell.cc	(revision ee8cdb02450fdfa9053b378628d72181b97f0d85)
@@ -1251,5 +1251,6 @@
     si_opt_2=save2;
     // now save the return-expr.
-    memcpy(res,&iiRETURNEXPR,sizeof(sleftv));
+    sLastPrinted.CleanUp(currRing);
+    memcpy(&sLastPrinted,&iiRETURNEXPR,sizeof(sleftv));
     iiRETURNEXPR.Init();
     // warning about args.:
@@ -1271,5 +1272,5 @@
     killlocals(myynest);
     // - return
-    newBuffer(omStrDup("\n;return();\n"),BT_execute);
+    newBuffer(omStrDup("\n;return(_);\n"),BT_execute);
     return (err!=0);
   }
Index: Tst/Short/branchTo.res.gz.uu
===================================================================
--- Tst/Short/branchTo.res.gz.uu	(revision 7fcc5b108e080c630a6e6190bdcccc10fca68ccd)
+++ Tst/Short/branchTo.res.gz.uu	(revision ee8cdb02450fdfa9053b378628d72181b97f0d85)
@@ -1,12 +1,18 @@
 begin 640 branchTo.res.gz
-M'XL("()C15@``V)R86YC:%1O+G)E<P!U4LMJPS`0O.<K%M&##,:)E$?3&'PH
-M[2%04DAR;G$2.18TLFM)A&+R[Y4L6Q&%@I'7NS/KW='L]B_K#0"0#-[6SX"4
-M5,D7/Z!TM.LK-`.3_.2"*QRE(_N&+(-#DXMCN:\2P:Z)5+GRA&D&/IXEYJB;
-MZ@@UP5PHX!&T@$RT0C%/X>:1\\PC*<%2-5R<079H]V$(,B0L`@+U!!+#$-*.
-MK*Y5GY&V`XDE#;L\WKO@R&>7=NS6[XCMP"BN2>1E(1,+@0#B?H)B'YBQ`CS]
-M#V_6#6`S!WO=;M^W&(E*P8D57+`3%%4#JF220=Z<]849,=5/S20*V`O+]LL1
-MMQPFW;6I%1!?6;H**K6E]P)#J3W@:0#D9B-S&%2H))2Y>08TG60P'D/#E&Y$
-MI[W21;'R99(XB>6WSAO6^Z!U<,P_C$PWOP,U?NO`Q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--- Tst/Short/branchTo.stat	(revision 7fcc5b108e080c630a6e6190bdcccc10fca68ccd)
+++ Tst/Short/branchTo.stat	(revision ee8cdb02450fdfa9053b378628d72181b97f0d85)
@@ -1,4 +1,4 @@
-1 >> tst_memory_0 :: 1480942444:4100, 64 bit:4.1.0:x86_64-Linux:nepomuck:108080
-1 >> tst_memory_1 :: 1480942444:4100, 64 bit:4.1.0:x86_64-Linux:nepomuck:2228224
-1 >> tst_memory_2 :: 1480942444:4100, 64 bit:4.1.0:x86_64-Linux:nepomuck:2228224
-1 >> tst_timer_1 :: 1480942444:4100, 64 bit:4.1.0:x86_64-Linux:nepomuck:0
+1 >> tst_memory_0 :: 1485792389:4100, 64 bit:4.1.0:x86_64-Linux:nepomuck:85072
+1 >> tst_memory_1 :: 1485792389:4100, 64 bit:4.1.0:x86_64-Linux:nepomuck:2211840
+1 >> tst_memory_2 :: 1485792389:4100, 64 bit:4.1.0:x86_64-Linux:nepomuck:2211840
+1 >> tst_timer_1 :: 1485792389:4100, 64 bit:4.1.0:x86_64-Linux:nepomuck:0
Index: Tst/Short/branchTo.tst
===================================================================
--- Tst/Short/branchTo.tst	(revision 7fcc5b108e080c630a6e6190bdcccc10fca68ccd)
+++ Tst/Short/branchTo.tst	(revision ee8cdb02450fdfa9053b378628d72181b97f0d85)
@@ -18,4 +18,31 @@
 proc tst(){branchTo("int",square); ERROR("No method found");}
 tst(2);
+//---------------------------------------------------------------
+newstruct("Net","list rows");
+
+proc printNet(Net N)
+{
+  list L = N.rows;
+  for (int j=1; j<=size(L); j++)
+  {
+    print(L[j]);
+  }
+}
+
+system("install","Net","print",printNet,1);
+
+proc netString(string M)
+{
+  Net N;
+  list L;
+  L[1]=M;
+  N.rows=L;
+  return(N);
+}
+
+proc net() {branchTo("string",netString);}
+
+typeof(net("abc"));
+Net N = net("abc");
 
 tst_status(1);$;
Index: kernel/combinatorics/hilb.cc
===================================================================
--- kernel/combinatorics/hilb.cc	(revision 7fcc5b108e080c630a6e6190bdcccc10fca68ccd)
+++ kernel/combinatorics/hilb.cc	(revision ee8cdb02450fdfa9053b378628d72181b97f0d85)
@@ -1428,18 +1428,4 @@
 }
 
-/*
-poly p_DivideMon(poly a, poly b, const ring r)
-{
-  int i;
-  poly result = p_Init(r);
-  int N=r->N;
-  for(i=1;i<=N; i++)
-  p_SetExp(result,i, p_GetExp(a,i,r)- p_GetExp(b,i,r),r);
-  p_SetComp(result, p_GetComp(a,r) - p_GetComp(b,r),r);
-  p_Setm(result,r);
-  return result;
-}
-*/
-
 static int isMonoIdBasesSame(ideal J, ideal Ob)
 {
