fix unread count query (#442)