Fixed end-of-game bugs.