Fixed ranged indexing bug