Copy-pasted code behaves diffrent

Heyas

I'm currently attempting to apply the code of tui-select to tui-list.
That is because tui-list simply made a 1 string list, while tui-select uses dynamicly up to 3 strings per line.

Anyway, so i copy pasted the code, and just made the changes marked with red....
Know that both scripts have ARGS=("${@}")

	unset OUT[@]
	MAX=3
	CUR=0
	DONE=0
	for OPT in "${ARGS[@]}"
	do	DONE=$((DONE+1))
		case $MODE in
		num)	count=$DONE	;;
		alpha)	count=$(num2char $DONE)	;;
		roman)	count=$(num2roman $DONE)	;;
		esac
		
		if [[ $CUR -lt $MAX ]]
		then	len=0
			for O in "${OUT[@]}";do len=$[ $len + ${#O} ];done
			ID="$count)"
			sum=$[ $len + ( ${#BORDER_LEFT} * 2 ) + 2 + ${#ID} + 1 ]
			if [[ $sum -lt $COLUMNS ]]
			then	OUT[$CUR]="$ID $OPT"
				shown=false
				CUR=$(( $CUR + 1 ))
			else	tui-echo "${OUT[0]}" "${OUT[1]}" "${OUT[2]}" >> /dev/stderr  
				shown=true
			fi
		fi
		if [[ $CUR -eq $MAX ]]
		then 	tui-echo "${OUT[0]}" "${OUT[1]}" "${OUT[2]}" >> /dev/stderr  
			shown=true
		fi
		#counter=$(( $counter + 1 ))
		$shown && CUR=0 && unset OUT[@]
	done
	# Print unprinted
	! $shown && tui-echo "${OUT[@]}" >> /dev/stderr

So given this little change, i would expect pretty much the same output:
But its not..

# But now i get this:
:) ~/prjs/tui/bin $ ./tui-list a b c
# |                                                                                                              | #
# |                                                                                                              | #
# |                                                                                                              | #

# Instead of what i expect from the 'source': (without the 2nd line)
:( ~/prjs/tui/bin $ ./tui-select a b c
# | 1) a                                                2) b                                                3) c | #
# | >  

Sure, the original code still works (if i'd uncomment it, $C handling is already replaced by $DONE)...

#	C=0
#	while [[ ! "" = "${ARGS[$C]}" ]];do
	#	case $MODE in
	#	num)	count=$DONE	;;
	#	alpha)	count=$(num2char $DONE)	;;
	#	roman)	count=$(num2roman $DONE)	;;
	#	esac
#		tui-echo "$count) ${ARGS[$C]}"
#		C=$((C+1))
#	done

But it only used the left algiment, while there could be a centred and right aligned too...

Any ideas please?

---------- Post updated at 17:02 ---------- Previous update was at 16:41 ----------

Me gringo... COLUMS was empty...
/solved

Looks unbalanced: ID="$count)"

He's trying to make a list like:

I) Accounts
II) Finance
III) Legal
IV) Payroll
1 Like