We prove a finiteness result in the space of arcs $X_\infty$ of a singular variety X, which is an extension of the stability result of Denef and Loeser (Germs of arcs on singular algebraic varieties and motivic integration, Invent. Math. 135 (1999), 201–232). From this follows a curve selection lemma for generically stable subsets of $X_\infty$. As a consequence, we extend to all dimensions the problem of wedges, proposed by Lejeune-Jalabert (Arcs analytiques et résolution minimale des singularités des surfaces quasi-homogénes, Lecture Notes in Mathematics, vol. 777 (Springer, Berlin, 1980), 303–336), and we obtain that an affirmative answer to this problem is equivalent to the surjectivity of the Nash map. This implies, for instance, that the Nash map is bijective for sandwiched surface singularities.