fixed String::replace

corrected a few mistakes in String::replace