fix def namespaces swapping, add test