Fix bug in pasting