fixed page count bug