Fix error with ended event.