Hmmmm, your script is acting oddly... Have you set any of the function codes to be null (blank) or do any 2 of them have the same value?
If that's not it, I can take a look at what's going on if you want to send me your config code. (I edited it out from above, but then found it didn't work anyway...

)
Cheers