Fix buggy crashes regarding exiting server