correctly initialize vector based on size