Clear the loop variable in addition to the callback list.

Closes #844.