index was off by 1