Fix edge case that leads to overscrolling.