how to find index of an object