changed the way to manage vector buffer