fixed a bug in computing TMID for sepectra