Minor enhancements in error handling