Fixed mutating tree while iterating