Fix race with gate pid (both start + end)