I tried something similar without any troubles, so it is definitely possible to do, you can download the source code here. You should be able to track down your problem by comparing the code I think.
If you have no success, feel free to send me your source to email@example.com and I will have a quick look if i can solve it. I fear i can’t help you out any further without the source code though.
One thing worth mentioning: You have to be aware that large numbers of objects in combination with several planets will have a huge impact on the performance.