Fix issue 12890 - index based replace
Merge pull request #2240 from Safety0ff/fix12890

Fix issue 12890 - index based replace