iterator reset function