fix logging and std detachment for daemons