Minor bug fix related to unregistering listeners.