TANAL-65: clear locals in loop when possible