Fixed a problem with events