fix isValidSquare