thanks the solution was to add wait_any_child rather than use wait_child