Fix the Leave event issue