change logic for server exit