fix contact details merge in message, add tests

This really only needed a one-line fix, but as it was happening in an area we had no test coverage for I implemented those tests as well. Fixes #179.