for loop correctly breaks