fixing event handler and example