add check diagonal
correct bug