fix exiting