diff --git a/.gitattributes b/.gitattributes
index d359ccede69e285f99a00dc1b69b11d846a4cc58..353b19e462803df38e2dcee180826444a7b527ee 100644
--- a/.gitattributes
+++ b/.gitattributes
@@ -197,7 +197,6 @@ testfont binary
 /src/cyclic.h foreign_ident
 /src/dlopen.c foreign_ident
 /src/dmalloc.h foreign_ident
-/src/docode.c foreign_ident
 /src/docode.h foreign_ident
 /src/dummy_ci.h foreign_ident
 /src/dynamic_buffer.c foreign_ident
diff --git a/src/docode.c b/src/docode.c
index 0953ae9f12b6e43b5a2a04c4fe64efe539da485b..73c255ce45b410441a8aa24ed0f555bae2bb8cb6 100644
--- a/src/docode.c
+++ b/src/docode.c
@@ -5,7 +5,7 @@
 \*/
 /**/
 #include "global.h"
-RCSID("$Id: docode.c,v 1.135 2001/09/29 08:47:03 hubbe Exp $");
+RCSID("$Id$");
 #include "las.h"
 #include "program.h"
 #include "pike_types.h"
@@ -513,9 +513,11 @@ static int do_encode_automap_arg_list(node *n,
 	depth++;
       }
       emit0(F_MARK);
+      PUSH_CLEANUP_FRAME(do_pop_mark, 0);
       code_expression(n, 0, "[*]");
       emit1(F_NUMBER, depth);
       emit_apply_builtin("__builtin.automap_marker");
+      POP_AND_DONT_CLEANUP;
       return 1;
     }
   }
@@ -1022,15 +1024,19 @@ static int do_docode2(node *n, INT16 flags)
 	fatal("HELP! FATAL INTERNAL COMPILER ERROR (1)\n");
 #endif
 
+      PUSH_CLEANUP_FRAME(do_pop_mark, 0);
       emit0(F_MARK);
+      PUSH_CLEANUP_FRAME(do_pop_mark, 0);
       emit0(F_MARK);
       emit0(F_LTOSVAL);
       emit1(F_NUMBER, depth);
       emit_apply_builtin("__builtin.automap_marker");
+      POP_AND_DONT_CLEANUP;
       emit_builtin_svalue("`+");
       emit2(F_REARRANGE,1,1);
       emit1(F_NUMBER, 1);
       emit_apply_builtin("__automap__");
+      POP_AND_DONT_CLEANUP;
 
       if(flags & DO_POP)
       {
@@ -1084,15 +1090,19 @@ static int do_docode2(node *n, INT16 flags)
 	fatal("HELP! FATAL INTERNAL COMPILER ERROR (1)\n");
 #endif
 
+      PUSH_CLEANUP_FRAME(do_pop_mark, 0);
       emit0(F_MARK);
+      PUSH_CLEANUP_FRAME(do_pop_mark, 0);
       emit0(F_MARK);
       emit0(F_LTOSVAL);
       emit1(F_NUMBER, depth);
       emit_apply_builtin("__builtin.automap_marker");
+      POP_AND_DONT_CLEANUP;
       emit_builtin_svalue("`-");
       emit2(F_REARRANGE,1,1);
       emit1(F_NUMBER, 1);
       emit_apply_builtin("__automap__");
+      POP_AND_DONT_CLEANUP;
 
       if(flags & DO_POP)
       {
@@ -2150,9 +2160,11 @@ static int do_docode2(node *n, INT16 flags)
 
   case F_AUTO_MAP:
     emit0(F_MARK);
+    PUSH_CLEANUP_FRAME(do_pop_mark, 0);
     code_expression(CAR(n), 0, "automap function");
     do_encode_automap_arg_list(CDR(n),0);
     emit_apply_builtin("__automap__");
+    POP_AND_DONT_CLEANUP;
     return 1;
 
   case F_AUTO_MAP_MARKER: