modify error handling