Confusing results in continue function - overaggressive optimization?