fix exiting flag