correct the method for calculating correlation