problem digital outputs using maxuino

i am using the duemilanove aruino board with the firmate v2 software on it. i try to steer 12 leds using max/msp, but i am having trouble when trying to turn on multiple leds at the same time.

i have connected the leds to the digital outputs, going from 2 (i don't want to use tx and rx) to 13. i simply use the maxuino software (arduino_test.maxpat). i am able to "talk" to the arduino, because i recieve the firmata version.

first i set all the digital pins to output at the "digital pin mode" area. then i try switching the leds on and off by pressing the led icons on the "digital pin output" area.

the problem is that some leds just turn on randomly. for example. when i light led 2, 3 and 4, then turn off 4 and then turn on 13, led 7 will suddenly turn on as well. when i press 13 again, led 7 will go off, but 13 will go on. there is absolutely no logic in this.

when i write a similar code in the arduino programmer, it works fine, so the problem really lies in the max/msp code.

it seems that i have to make some kind of loop which keeps telling the leds to stay off, until i want one of them to turn on. but before i do this i was wondering: has anybody else ever had this problem and how did you solve it?