game ending. resolved stackoverflow