Pdf generation fix