Fix pid file creation