Fix "ended" event