use apply instead of destructing a vector