Fixed counter in continue function