Fix bug where events of certain subclasses were not properly handled.