fix generic indexing method