bug fix, wrong index