fix reading of pid