Fix CPU usage in proxy handler