correct the sampling and window size