generalized getindex