fixed program exiting