improved error handling/reporting