fix the bug of widening the sliding window.