fix bug when window_size<0, change default value to 1