fix index_range implementation