added getEventTypeByName method and prevent npe when calling events with
a null type