Fix bugs with namespaces