Fixes event handling