Bug fix with sliding window scaling