fixes to endgame logic