Fix: only optimize for unserialized dataset case.