fixed how bug in readSpectrum function