fix crash with many chains on add_event_chain

Signed-off-by: xiehuc <xiehuc@gmail.com>