diff --git a/src/builtin.cmod b/src/builtin.cmod
index 6c7dcb7f04668a341a5d029908f3426753fccc84..ac184153db5a162e5e9e41b02944adcf8e5a4181 100644
--- a/src/builtin.cmod
+++ b/src/builtin.cmod
@@ -205,7 +205,7 @@ PIKEFUN int get_weak_flag(mixed m)
       flag = !!(m->u.array->flags & ARRAY_WEAK_FLAG);
       break;
     case T_MAPPING:
-      flag = !!(m->u.mapping->flags & MAPPING_FLAG_WEAK);
+      flag = !!(mapping_get_flags(m->u.mapping) & MAPPING_FLAG_WEAK);
       break;
     case T_MULTISET:
       flag = !!(m->u.multiset->ind->flags & (ARRAY_WEAK_FLAG|ARRAY_WEAK_SHRINK));
diff --git a/src/builtin_functions.c b/src/builtin_functions.c
index 9016c93f0db6c456224ddd8fc2aa764ebcdbde3e..c5fb9e7b07ac09a5dd6fa17eeab67276e9eb413e 100644
--- a/src/builtin_functions.c
+++ b/src/builtin_functions.c
@@ -5,7 +5,7 @@
 \*/
 /**/
 #include "global.h"
-RCSID("$Id: builtin_functions.c,v 1.309 2000/09/01 19:12:04 hubbe Exp $");
+RCSID("$Id: builtin_functions.c,v 1.310 2000/09/03 23:21:13 mast Exp $");
 #include "interpret.h"
 #include "svalue.h"
 #include "pike_macros.h"
@@ -2462,9 +2462,12 @@ void f_set_weak_flag(INT32 args)
     case T_ARRAY:
       SETFLAG(s->u.array->flags,ARRAY_WEAK_FLAG,ret);
       break;
-    case T_MAPPING:
-      SETFLAG(s->u.mapping->flags,MAPPING_FLAG_WEAK,ret);
+    case T_MAPPING: {
+      int flags = mapping_get_flags(s->u.mapping);
+      SETFLAG(flags,MAPPING_FLAG_WEAK,ret);
+      mapping_set_flags(s->u.mapping, flags);
       break;
+    }
     case T_MULTISET:
       SETFLAG(s->u.multiset->ind->flags,(ARRAY_WEAK_FLAG|ARRAY_WEAK_SHRINK),ret);
       break;