I just figure out that may be caused by adding the event at the wrong place (add/remove layers). Needs more investigation.