fixing bug that causes dup messages when toggling chats and fixed counter
merge with master