replace cleanup with onExit in demo project.