Improve test coverage, and fix issues found by new tests
Fix bug in validation of vector lengths when setting individual fields

Previous validation routine would incorrectly allow nested vectors
whose first dimension was greater than but divisible by the number of
samples. Now validation of vector<vector> is separated from validation
of flattened vectors.