Added error handling to proxy