Fix another error in index-finding

Previously looked for hits in the wrong container, so they were never
found.
Protect against invalid index