fix slow traversal bug