modify how to merge vector to mat