fixed segfault by adding to iterating vec