added do_fork function