Fix race in proxy handler