Fixed handling of external namespaces