Addevent for :leaving and :connect