Enhance the error handling
enhance error handling