fixed bug in readSpectrum