add wait for parallel processes