fixed bug in getSpectrum