Fix error in spectrum array indexing