Handle null NamespaceContext correctly