Sort friend by name
Fix bug in add_friend

When an existing friend's name is changed, the new name is not saved in
db.