Fix bugs in ThreadVector.