make rendering safe, fix undo