Hi Rui and
to the forum.
I would strongly suggest that you don't waste any more time trying to modify the Magic Pie to take a nine speed cassette, because you are very unlikely to use the majority of those gears when you start using the power from the Pie.
I live in a very hilly area and tend to use my highest gear virtually all of the time, apart from when I use a low gear just to pull away from a standstill on very steep hills, and then quickly change straight through to my highest gear. When you start riding with the power from the Pie, you'll find that the number of gears is much less important than when you were using pedal power alone.
If you're a keen cyclist and still intend to do a lot of hard pedalling without motor assistance, you will soon discover that the Magic Pie is hard work to ride with without using the throttle.
However, if you are really determined to use all nine gears, then I would suggest that the
DNP Epoch 9 Speed 11-32 tooth freewheel might be the easiest option:
Here's a Magic Pie that Erik fitted with a nine speed freewheel:
Check out
this post for more details.
Alan