Fix additional bugs in the vector array fetching code.

And a test case to catch it.

Change-Id: I233269822b383afa9783bdc7318eddee31d1eaa3