Fixed errors when processing PDFs and displaying counter. Fixes #48