Bug in detection of ending at final square.