fixing 'count of the new messages should reset, when user is inside chat' plus fixing additional bugs