record pid at the start