fixed document generation