do any values greater than 9 match correctly? or more specifically, do any two digit values match correctly?
i suspect a good way to fix this might be to use a modulo operation as per How to do modulus calculation in maestro 7 prior to the switch statement to make your entire switch statement a lot simpler.