Fixed a binary problem in writing the pdf