update loop variable