refactor newProxyInstance