fix pid file crash bug