Fixed bugs in events