Fix use-after-free
Merge branch 'byte_events_clear_fix' into test
test