Need this for write_pid, fixes #1636