fix onEnd()