Handle page size changes correctly.