cleanup in endgame