solved bug on application exit