Solved a crash when quitting