So, you are 'retrieving' directly from the custodians? You're not downloading to a supported institutional broker/dealer interface file, and then importing, right?
I'd suggest doing this to debug the problem.
0) Save everything, and turn off "Options / Save Investments/Portfolio on Exit". This will allow you to experiment, without saving anything on exit.
1) Find a mis-placed transaction
2) Delete this transaction
3) Re-retrieve, and try to reproduce having the investment go into a wrong sub-portfolio.
If the transaction does again go into this wrong investment, see if this investment is also located in another sub-portfolio that you did retrieve. It may be that you've put the same investment file in 2 different sub-portfolios somehow. When you update an investment file in any sub-portfolio, that same investment file will also be updated in any other sub-portfolio that it is located in. To see if you have this investment file located in more than 1 sub-portfolio, you can create a custom report with "Path and filename". Create the report at your top sub-portfolio, and turn off sub-totaling. Sort the report by this Path and filename under the "Sort" menu after creating the report. Scroll down to the investment in question, and see if the same path/filename is open more than one time.