Fix undo eating all the ram.