fix bugs in namespace traversal