Fix bug, shut down application in start or end point