made all forking operations use a pid_t variable