fixed pagebreak logic