Bugfix: str-replace when $old at beginning of string

Hi,
there's a bug with str-replace when the `$old` string is found at the beginning of `$string`. In other words when `str-index()` returns 1.
This patch intends to fix it.

PS: keep up the good work!