fixed some end-of-game bugs and formatting