I'm trying to create an event but I get a NullReferenceException