make it run in fg and bg