Fixed multiple event handler registration bug