simplifying testing and adding a check to shut down the master if all the children die immediately