Fixing bugs.

Still has problem with buffer and an exception about reading pdf.

The pdf file is corrupted