better error reporting for debugging