fixed incorrect coherence calculation