Fix sort order when selecting nodes