update events function