Fixed pasting and key events