fix removeEmptySpectra handling