fixing correlation calculation