fix error in calculating page to view in staged messages