Fix page counting