fix the bug for spectral clustering algorithms