finally fix, onEnd() works, cleanup