fix: indexof, replace rewriting