Fixed traverse and added a test.