fix switching pages with infinite scrolling