Updating the error handling