creating fix on str_replace and also adding regression test