better NPE diagnostics