Fixed bug in events