Fix bug #9236: After we recreate the DocumentClass, we have to apply
it to the document.