Lookups for unknown status codes were broken

And other small refinements.
Fix side effect in assertion