Replace deprecated replaceWholeText with replaceData