fixed mean_spectrum, need to fix scan_spectra