Fix undo while drawing