Fixes for PDF generation