Fiexed RuntimeException during pdf generation