Fixed a bug that made it impossible to exit