ended event check added