Add failing iteration test.
Avoid accidental calling of functions in iteration block. Closes #986