Test sorting of contacts

for issue #467