Enhance error handling.