Fix events handling in examples