remove function inside a loop.