main: fix the pidfile handling (broken with the -u,-g movement)