Fixes for pdf generation