Fixed circular import problem when events is enabled