getting index right