fixing page calculation