remove some redundant traversal code.