fixed a bug about duplicated events