Fixed custom correlation matrix calculation