Fix pdf generation