hardened error handling