Fix setting of current working directory for background processes