improve page break calculation