Fixed DTW indexing bug