fixed bug on ending game