fix bug for quit