Correct issue in hunt functions when finding end of array