Fixed critical bug where events weren't properly deregistered.