fixing infinite scrolling bug