changed text-pasted logic