Fix for trying to write null undo buffer.