Fix clear each iteration

The clear_each_iteration parameter as described in the examples and the documentation was being ignored.

This should fix it.