Fix edge case with nested choices. Fixes #560

When the set of choices is a list containing a named vector of length 1,
choicesWithNames would return the wrong result.