handle edge case n_distinct( <0 length vector>). closes #458