Fix index generation