Correctly handle single-element vectors to fix an assertion failure. Add tests that were missing from the original commit. Differential Revision: D151782