improve status and error handling