small fix to the infinite scroll function