fix crashes on events