document generation error fix