fixed bug with events