fix. in format_namespace ensure that a copy of the set containing namespaces is passed.