Fixing event bug