fixed fg and bg job handling issues