Fixed a bug in the calculation of the correlations