Fixed bug in Indices algorithm