add wait for subprocess