Fix some stuff when pasting