added return i in indexer method
It works!

Finally got the image indexing to work!