minor bug fix: wrong use of 1D array indexing