improve tail call loop.