fix pidfile and backgrounding