fixed exits bug