fixing up pidfile functionality