memory leak in events fixed