refine error reporting