Fix index off by 1