better error logging/reporting