Moving messages to the wrong account

I have two accounts configured in Mail and my Junk folder is on an IMAP server so I can see the messages it marks as spam no matter what computer I’m on. When I mark a message as good, it is moving all messages, no matter what account they are associated with, to a single account (the one with the Junk folder). In earlier versions it worked correctly. I don’t believe I’ve touched my settings.

Mail doesn’t remember which account the messages came from, so SpamSieve has to guess based on the To address in the message and the addresses for your accounts. Often, there isn’t enough information to tell. If it doesn’t find a match, it just uses the first account in the list. If you re-order the accounts in Mail’s preferences you can control which is the first account, and thus the default.