Fix index out of bounce