Fix issure related to not exiting at the end