error handling enhancement