Improve to handle also paste event