update vector on loop