fix the scroll function