HTML5: fixing undo and clearPaper events in the server