multiple replaces and fix set-var bug