Fixed small bug. length is index + 1.