bug fix for check game end