Fix bug in indexObject