OK, I think I found the problem.
The menu automatically sorts names from A to Z, so when I add submenus (from the menu list screen) like:
1- Menu Name, 2- Menu Name ,
the order is correct and items do not get mixed. So, somewhere in the script this sorting function should be disabled ?
I am hoping you can verify this.