fixing logic for filtering listeners for which to remove