fixed autocorrelation implementation