WIP fix bugs after introduction of namespaces, found trying to run the testsuite