I believe this is because of the vars in your while statement. Try the following:

Code:
while (%user [ $+ [ %unitnumber ] ]) { inc %unitnumber }


%user [ $+ [ %unitnumber ] ] makes it so the %unitnumber variable gets evaluated first so you, in the end, become %user1 etc.

Tata :>