diff --git a/src/builtin_functions.c b/src/builtin_functions.c
index 7c64a7190e953dc8c12309250099725fe23751f6..34d7dc305ea076b5b56093ceec642ebbd1359864 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.386 2001/06/29 02:14:56 hubbe Exp $");
+RCSID("$Id: builtin_functions.c,v 1.387 2001/06/29 10:47:37 grubba Exp $");
 #include "interpret.h"
 #include "svalue.h"
 #include "pike_macros.h"
@@ -3115,10 +3115,12 @@ node *optimize_replace(node *n)
 	} else {
 	  extern struct program *multi_string_replace_program;
 	  INT16 lfun;
-	  struct object *replace_obj =
-	    clone_object(multi_string_replace_program,
-			 eval_low(*arg1) + eval_low(*arg2));
+	  struct object *replace_obj;
 	  node *ret = NULL;
+	  INT32 args = eval_low(*arg1);	/* NOTE: Addition splitted to ensure */
+	  args += eval_low(*arg2);	/*       correct evaluation order.   */
+
+	  replace_obj = clone_object(multi_string_replace_program, args);
 
 	  push_object(replace_obj);
 	  if (replace_obj->prog &&