Fix bug in creating namespaces