More careful handling of tree namespace migration