fixed leaking error object