Fixing bug where page count not being set correctly.