0 pages bug fix

Sometimes  the NumberOfPages wasn't the last entry (in my case because there were bookmarks listed afterwards). This works though.