Fixed a bug in the pid writing function, which couldn't be