fix .replace bug (not in-place, re-assign result)