Fix document creation.