PDF generation fix