fixed current index = -1 crash