fixing traverse test case for for loops