This fixes a problem in nth's linear traversal helper whereas an
index-out-of-bounds might not be thrown in the appropriate
circumstances.
Also fixes a bug whereby the not-found argument might not be used.