Fix sigchld handling (bug #2245)