modified do_bgfg, todo fix no child process error