add error checking to some fork() calls