fixed some iterator leaks