prevent memory corruption by calling erase on unallocated vector