correctly exit from forks