Sometimes the index returns nil

This fixes a test failure that I should have caught by looking at the
autotest window