Fix events not being emitted