fixed problem with vectors in loop