Fixed a bug in events on PHP 5.3