Fix index rollover