fixed exiting from the program