improving error diagnostics