fixed error in transition index logic