Don't crash when metadata contains private top level type.
Merge some nrefactory changes