handling text replacement