fix onEnd