fixed problem when quitting the application