fix on undo redo while mouse leaving the area