Account Addresses after moving wallet.dat to new computer I reinstalled bitcoin on a new computer, and took my old wallet.dat file from an old pc that had v.0.3 of the bitcoin software.

I had 2 receiving addresses when I started.
When I typed getaddressesbyaccount ""
it listed the 2 addresses.

I then did the command getnewaddress
then noticed that my wallet.backup file had assigned new reserved addresses.

I did a test spend between my 2 old addresses.  I sent 0.0001 for the 1st address to 2nd address, expecting change to come back to the first, but it
seems that the unspent got sent to the 3rd.  

It looks like account name is set by the label.  Everything seems to still belong to the wallet but I have 2 accounts, 1 with 2 addresses.

Here is the transaction:
https://blockchain.info/address/1FsmCgxrrKFPgLxrMgTWUAintbtLeeDf2S

It appears that when I use Bitcoin-qt it thinks that the main account is 18ffH16dzkg64nh8rj8JtSL7K6QYzBBwV2 even though 1FsmCgxrrKFPgLxrMgTWUAintbtLeeDf2S was originally the 1st receiving address. 

There doesn't appear to be an obvious intuitive way to determine which account recieves the unspent part of the transaction back.

Not that is should matter as I own them all, but I am trying to understand how this works.
For this transaction it's 12mjN8ZX8nLNLw9KqTEWoR32J1hsKptEh5 that is the change address.

When you transfer from core it creates a new change address to recieve the balance.

If you do listtransactions you can see them all. listreceivedbyaccount may also be helpful.

Something that is helpful to keep in mind when looking at transactions is there there is no from address, something that sites like blockchain.info show and can be confusing.