fixed exiting app issues