fix a bug with scroll position tracking