The patch below should work for you. To find out where you were going wrong try putting a [print] after each outlet and seeing where the output differs from what you would expect. Oh, and remember the "autopopulate" attribute of [umenu].
— Pasted Max Patch, click to expand. —
Copy all of the following text. Then, in Max, select New From Clipboard.