fix app exit