end event now emited correctly