fixed crash when exit program