bug fixing in Iterate.cpp