Fix copy-on-write for AD subclass objects.