Fixed a bug in getting the unread counts