Fixed broken document creation.