fixed indexing problem in SNR calculation