core: fix 'break' detection in loops