fixed event class type to event_type for active record column name reason and added guard