Sudoku solver working properly