fix bug for iterate()