Fixed a couple of bugs in vector and a bug in vector_ts test that was causing a segfault occasionally.