fixes on PDF generation