Friends appearing twice is not necessarily a fault - people in multiple games or who leave the desktop app running while playing will show multiple times.
I noticed that guild members logged in to the remote guild chat don't show in the list. As with comment #113 (line numbers updated here for 5.4-R1), I changed line 762 to:
if connected or isMobile then
then to get the right count of guild members to include remote chat people I changed line 339 to:
local guildTotal, clients, online = GetNumGuildMembers()