Fix document creation issue