use byte string when writing to pid file - fix #504