Fixed issue where findAndReplace helper function would get into infinite loop when the oldStr and newStr are equal.