fixed bug in count() for determining win state