Fix exit

Fix against #1140