Fixed optimizer bug in handling of replace(). Fixes [bug 1711 (#1711)] Rev: src/builtin_functions.c:1.370 Rev: src/testsuite.in:1.419