fix memory overwrite in proxy mode