Fix ArrayIndexOutOfBoundsException when accessing hits[] that is shorter
than MAX_RESULTS.