fixed errors caused by usage of Vector.capacity instead of Vector.size