fixing infinite scroll bug