Corrected a bug in the pdf generation