Fix bug with saving to PDF