Fixes to error reporting throughout.